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
180
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
410
Web Directions - Code Leaders - Hiring Juniors
radar
0
610
The Future of Rails - Take 2
radar
0
110
The Future of Rails
radar
1
120
Exploding Rails
radar
9
1.8k
Hiring Juniors
radar
2
440
The Perfect Coding Test
radar
0
120
Your First Developer Job
radar
1
110
Hiring Juniors
radar
2
280
Other Decks in Programming
See All in Programming
一人でAIプロダクトを作るための工夫 〜技術選定・開発プロセス編〜 / I want AI to work harder
rkaga
12
2.7k
Understanding Ruby Grammar Through Conflicts
yui_knk
1
110
新世界の理解
koriym
0
140
Constant integer division faster than compiler-generated code
herumi
2
670
[DevinMeetupTokyo2025] コード書かせないDevinの使い方
takumiyoshikawa
2
280
未来を拓くAI技術〜エージェント開発とAI駆動開発〜
leveragestech
2
150
CEDEC2025 長期運営ゲームをあと10年続けるための0から始める自動テスト ~4000項目を50%自動化し、月1→毎日実行にした3年間~
akatsukigames_tech
0
140
Vibe coding コードレビュー
kinopeee
0
450
AIエージェント開発、DevOps and LLMOps
ymd65536
1
110
The State of Fluid (2025)
s2b
0
170
Go製CLIツールをnpmで配布するには
syumai
2
1.2k
#QiitaBash TDDで(自分の)開発がどう変わったか
ryosukedtomita
1
370
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
770
4 Signs Your Business is Dying
shpigford
184
22k
Producing Creativity
orderedlist
PRO
347
40k
Designing Experiences People Love
moore
142
24k
How to Ace a Technical Interview
jacobian
279
23k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
20k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Designing for Performance
lara
610
69k
Optimizing for Happiness
mojombo
379
70k
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