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
アセットのコンパイルについて
ojun9
0
120
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
120
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
640
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
720
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.4k
@Environment(\.keyPath)那么好我不允许你们不知道! / atEnvironment keyPath is so good and you should know it!
lovee
0
110
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
120
ProxyによるWindow間RPC機構の構築
syumai
3
1.1k
旅行プランAIエージェント開発の裏側
ippo012
2
890
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
210
AWS発のAIエディタKiroを使ってみた
iriikeita
1
180
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Cult of Friendly URLs
andyhume
79
6.6k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Art, The Web, and Tiny UX
lynnandtonic
302
21k
Done Done
chrislema
185
16k
A Tale of Four Properties
chriscoyier
160
23k
How to Think Like a Performance Engineer
csswizardry
26
1.9k
For a Future-Friendly Web
brad_frost
180
9.9k
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