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
Scaling Spree's API
Search
Ryan Bigg
February 27, 2014
Programming
0
170
Scaling Spree's API
Ryan Bigg
February 27, 2014
Tweet
Share
More Decks by Ryan Bigg
See All by Ryan Bigg
Hiring Juniors - RubyConf Indonesia 2019 Closing Keynote
radar
1
380
Web Directions - Code Leaders - Hiring Juniors
radar
0
540
The Future of Rails - Take 2
radar
0
96
The Future of Rails
radar
1
100
Exploding Rails
radar
9
1.8k
Hiring Juniors
radar
2
420
The Perfect Coding Test
radar
0
110
Your First Developer Job
radar
1
110
Hiring Juniors
radar
2
270
Other Decks in Programming
See All in Programming
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
360
最近のVS Codeで気になるニュース 2025/01
74th
1
240
個人アプリを2年ぶりにアプデしたから褒めて / I just updated my personal app, praise me!
lovee
0
300
CloudNativePGがCNCF Sandboxプロジェクトになったぞ! 〜CloudNativePGの仕組みの紹介〜
nnaka2992
0
190
Azure AI Foundryのご紹介
qt_luigi
1
260
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
200
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
230
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
190
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
140
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
790
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
4.2k
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
150
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
GitHub's CSS Performance
jonrohan
1030
460k
RailsConf 2023
tenderlove
29
980
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
380
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Speed Design
sergeychernyshev
25
760
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Transcript
Scaling Spree
None
Rendered spree/api/products/index.v1.rabl ! in 1760.2ms
! cache @product api/app/views/spree/api/products/show.v1.rabl
Rendered spree/api/products/index.v1.rabl ! in 79.7ms 22x faster!
None
DO: 2GB Droplet (SFO) Apache Bench (ab) Benchmarker
DO: 2GB Droplet (NYC) Spree: master stock nginx + puma
Test Server
requests=1000, concurrency=50! ! Requests per second: 11.38
requests=10000,! concurrency=500! ! Requests per second: N/A! Load average: 26.14!
DO: 4GB droplet! ! Requests per second: N/A! Total of
33 requests completed!
nginx sez:! ”512 worker_connections not enough"
! *Google for "nginx worker_connections"* ! ! events {! worker_connections
19000;! }! ! worker_rlimit_nofile 20000;
! requests=1000, concurrency=500! ! Requests per second: 39.84 3.5x faster!!
Percentage of the requests served within a certain time (ms)!
50% 6379! …! 75% 10297! …! 100% 25090 (longest request)
Percentage of the requests served within a certain time (ms)!
50% 6379! …! 75% 10297! …! 100% 25090 (longest request)
1 [|||||||||||||||||||||||||||||||||||||100.0%] 2 [|||||||||||||||||||||||||||||||||||||100.0%]
DO: 32GB droplet, 12 cores!
39 req/s x 6?! 2 cores => 12 cores! ~10x
faster?!
! requests=1000, concurrency=500! ! Requests per second: 58.84 [#/sec] (mean)
5.2x faster!!
! expires_in 3.minutes api/app/controllers/spree/products_controller.rb
None
! requests=1000, concurrency=500! ! Requests per second: 529.19 [#/sec] (mean)
48x faster!!
None
! requests=1000, concurrency=500! ! Requests per second: ! 1705.49 155x
faster!!
! requests=10000, concurrency=1000! ! Requests per second: ! 1859 169x
faster!!
CACHE EXPIRY?! !1
None
Purge everything Purge by key Purge by URL
Purging by key headers[‘Surrogate-Key’] = “product_id=1” headers[‘Surrogate-Key’] =! “product_id=1 taxon_id=1
taxon_id=2”! !
Purging URLs /api/products! ! /products/ruby-on-rails-tote