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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ryan Bigg
February 27, 2014
Programming
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Scaling Spree's API
Ryan Bigg
February 27, 2014
More Decks by Ryan Bigg
See All by Ryan Bigg
Hiring Juniors - RubyConf Indonesia 2019 Closing Keynote
radar
1
460
Web Directions - Code Leaders - Hiring Juniors
radar
0
700
The Future of Rails - Take 2
radar
0
150
The Future of Rails
radar
1
170
Exploding Rails
radar
9
1.9k
Hiring Juniors
radar
2
480
The Perfect Coding Test
radar
0
150
Your First Developer Job
radar
1
120
Hiring Juniors
radar
2
300
Other Decks in Programming
See All in Programming
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
310
えっ!!コードを読まずに開発を!?
hananouchi
0
170
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
130
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
120
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.8k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
300
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
190
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
210
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
240
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
580
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
Featured
See All Featured
Believing is Seeing
oripsolob
1
170
Scaling GitHub
holman
464
140k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
460
Technical Leadership for Architectural Decision Making
baasie
3
440
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
320
A Tale of Four Properties
chriscoyier
163
24k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Thoughts on Productivity
jonyablonski
76
5.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
[SF Ruby Conf 2025] Rails X
palkan
2
1.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
560
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