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
680
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
65
Coercion in Ruby
arnvald
1
120
Writing config files in Ruby
arnvald
0
110
Speaking at RDRC
arnvald
0
100
Read more
arnvald
2
76
The simplest gem you'll ever use
arnvald
0
72
International to global
arnvald
0
68
Patterns, patterns everywhere
arnvald
0
84
Nomadic programmer - Baruco 2014 edition
arnvald
0
120
Other Decks in Programming
See All in Programming
DataformでPythonする / dataform-de-python
snhryt
0
160
202507_ADKで始めるエージェント開発の基本 〜デモを通じて紹介〜(奥田りさ)The Basics of Agent Development with ADK — A Demo-Focused Introduction
risatube
PRO
6
1.4k
CLI ツールを Go ライブラリ として再実装する理由 / Why reimplement a CLI tool as a Go library
ktr_0731
3
1k
あのころの iPod を どうにか再生させたい
orumin
2
2.2k
「リーダーは意思決定する人」って本当?~ 学びを現場で活かす、リーダー4ヶ月目の試行錯誤 ~
marina1017
0
160
STUNMESH-go: Wireguard NAT穿隧工具的源起與介紹
tjjh89017
0
250
ZeroETLで始めるDynamoDBとS3の連携
afooooil
0
150
リッチエディターを安全に開発・運用するために
unachang113
1
360
Flutterと Vibe Coding で個人開発!
hyshu
1
230
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
21
10k
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
0
490
書き捨てではなく継続開発可能なコードをAIコーディングエージェントで書くために意識していること
shuyakinjo
0
220
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
We Have a Design System, Now What?
morganepeng
53
7.7k
Bash Introduction
62gerente
614
210k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
Unsuck your backbone
ammeep
671
58k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.4k
Designing for humans not robots
tammielis
253
25k
Thoughts on Productivity
jonyablonski
69
4.8k
The Cult of Friendly URLs
andyhume
79
6.5k
KATA
mclloyd
32
14k
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