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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ryan Bigg
February 27, 2014
Programming
190
0
Share
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
450
Web Directions - Code Leaders - Hiring Juniors
radar
0
690
The Future of Rails - Take 2
radar
0
140
The Future of Rails
radar
1
150
Exploding Rails
radar
9
1.9k
Hiring Juniors
radar
2
470
The Perfect Coding Test
radar
0
140
Your First Developer Job
radar
1
120
Hiring Juniors
radar
2
290
Other Decks in Programming
See All in Programming
🦞OpenClaw works with AWS
licux
1
310
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
710
個人的に嬉しかったpnpmの新機能・3選
matsuo_atsushi
0
120
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
470
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
110
Explore CoroutineScope
tomoeng11
0
130
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
2
370
第3木曜LT会 #28
tinykitten
PRO
0
120
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
940
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
260
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
250
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
340
58k
Odyssey Design
rkendrick25
PRO
2
590
Designing Experiences People Love
moore
143
24k
Building an army of robots
kneath
306
46k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
230
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
340
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
450
For a Future-Friendly Web
brad_frost
183
10k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
The agentic SEO stack - context over prompts
schlessera
0
770
Writing Fast Ruby
sferik
630
63k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
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