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
200
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
450
Web Directions - Code Leaders - Hiring Juniors
radar
0
700
The Future of Rails - Take 2
radar
0
150
The Future of Rails
radar
1
160
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
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
150
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
6.2k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
160
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.2k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
160
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
340
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.5k
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
510
Modding RubyKaigi for Myself
yui_knk
0
900
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
510
CSC307 Lecture 17
javiergs
PRO
0
320
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
310
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
570
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Evolving SEO for Evolving Search Engines
ryanjones
0
210
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
4 Signs Your Business is Dying
shpigford
187
22k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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