Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Your API is too slow!
Search
Grzegorz Witek
June 23, 2016
Programming
0
720
Your API is too slow!
RedDotRubyConf 2016
Grzegorz Witek
June 23, 2016
Tweet
Share
More Decks by Grzegorz Witek
See All by Grzegorz Witek
One Year with Hanami
arnvald
0
80
Coercion in Ruby
arnvald
1
170
Writing config files in Ruby
arnvald
0
140
Speaking at RDRC
arnvald
0
150
Read more
arnvald
2
99
The simplest gem you'll ever use
arnvald
0
110
International to global
arnvald
0
110
Patterns, patterns everywhere
arnvald
0
130
Nomadic programmer - Baruco 2014 edition
arnvald
0
130
Other Decks in Programming
See All in Programming
2026/02/04 AIキャラクター人格の実装論 口 調の模倣から、コンテキスト制御による 『思想』と『行動』の創発へ
sr2mg4
0
650
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
7
1.2k
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
430
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.2k
Ruby x Terminal
a_matsuda
5
530
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
260
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
あなたはユーザーではない #PdENight
kajitack
4
290
浮動小数の比較について
kishikawakatsumi
0
360
Claude Code、ちょっとした工夫で開発体験が変わる
tigertora7571
0
190
Oxlint JS plugins
kazupon
1
1.1k
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
170
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
How to Talk to Developers About Accessibility
jct
2
140
How to build a perfect <img>
jonoalderson
1
5.2k
4 Signs Your Business is Dying
shpigford
187
22k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
2
65
Ethics towards AI in product and experience design
skipperchong
2
210
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
190
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
200
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
Transcript
@arnvald, RedDotRubyConf 2016 YOUR API IS TOO SLOW!
None
@arnvald, RedDotRubyConf 2016 YOUR API IS TOO SLOW!
@arnvald, RedDotRubyConf 2016 YOUR API IS TOO SLOW! 2TQDCDN[ HCUVGPQWIJ
Grzegorz Witek
is speed a feature?
is lack of speed a bug?
Algolia Github
Web application optimization loading priority static content dynamic content domain
sharing JavaScript compression asset minifying CSS HTML un-CSS prefetching HTTP/2 image sprites CDN database optimization multi-threading
Web API optimization loading priority static content dynamic content domain
sharing JavaScript compression asset minifying CSS HTML un-CSS prefetching HTTP/2 image sprites CDN database optimization multi-threading
Long way of a request ! " #
Latency ! " #
Where are your users? "
Where are your users? " Singapore Jakarta 13ms
Where are your users? " Singapore Hanoi 100ms
Where are your users? " Singapore New York 265ms
Where are your users? " Singapore Shanghai 320ms
Dynamic content acceleration ! CDN #
Latency
Latency
Long way of a request ! " #
Processing #
Don’t be a smart-ass “Oh, I know, we have to
cache it!”
Measure gem 'ruby-prof' gem 'rack-mini-profiler'
Measure in production mode pre-production stage
Measure gem 'newrelic' gem 'skylight'
Measure profile - focus on the slowest part
Measure benchmark - compare alternative solutions
Improve
Improve Rely on your database
Improve Where is your cache?
Improve Redis on a separate machine - fast Redis on
the same machine - faster Application memory - the fastest
Improve Multi-layered cache (Russian doll caching)
Improve When needed - mutate
Improve Upgrade your libraries
Improve When needed - replace your libraries
Improve gem 'json' gem 'oj' gem 'oj-mimic-json'
Improve Native extensions - not only C!
Improve https://github.com/rustbridge/helix https://github.com/d-unseductable/ruru
Improve Move processing to the background
Improve When desperate - extract part of the application
Improve I said "when desperate" not "ASAP NOW!!!11"
Improve I said "part", not "rewrite everything in Go"
Improve There's more, way more
Long way of a request ! " #
Download ! " #
Improve Not only GZIP
Long way of a request ! " #
Speed up your API use CDN infrastructure profile and benchmark
focus on the slowest part rewriting is the last thing to consider
Speed up your API Ruby is fast enough Sinatra is
fast enough Rails is fast enough
@arnvald, RedDotRubyConf 2016 YOUR API IS TOO SLOW! 2TQDCDN[ HCUVGPQWIJ