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
110
Writing config files in Ruby
arnvald
0
100
Speaking at RDRC
arnvald
0
99
Read more
arnvald
2
74
The simplest gem you'll ever use
arnvald
0
69
International to global
arnvald
0
66
Patterns, patterns everywhere
arnvald
0
80
Nomadic programmer - Baruco 2014 edition
arnvald
0
120
Other Decks in Programming
See All in Programming
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
570
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
220
Deep Dive into ~/.claude/projects
hiragram
14
8k
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
12k
ふつうの技術スタックでアート作品を作ってみる
akira888
1
1.1k
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.4k
生成AI時代のコンポーネントライブラリの作り方
touyou
1
250
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
240
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
940
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
640
Hack Claude Code with Claude Code
choplin
5
2.4k
Git Sync を超える!OSS で実現する CDK Pull 型デプロイ / Deploying CDK with PipeCD in Pull-style
tkikuc
3
150
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
KATA
mclloyd
30
14k
Rails Girls Zürich Keynote
gr2m
95
14k
Side Projects
sachag
455
42k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Bash Introduction
62gerente
613
210k
How STYLIGHT went responsive
nonsquared
100
5.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
How GitHub (no longer) Works
holman
314
140k
How to Think Like a Performance Engineer
csswizardry
25
1.7k
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