$30 off During Our Annual Pro Sale. View Details »
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
420
Web Directions - Code Leaders - Hiring Juniors
radar
0
650
The Future of Rails - Take 2
radar
0
110
The Future of Rails
radar
1
130
Exploding Rails
radar
9
1.9k
Hiring Juniors
radar
2
450
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
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
310
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
6
1.2k
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
120
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
3
790
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.8k
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
200
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
230
AI時代もSEOを頑張っている話
shirahama_x
0
270
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
2k
connect-python: convenient protobuf RPC for Python
anuraaga
0
370
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
680
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
220
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
76
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
A Tale of Four Properties
chriscoyier
162
23k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
The Art of Programming - Codeland 2020
erikaheidi
56
14k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.1k
Music & Morning Musume
bryan
46
7k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.7k
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