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
170
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
310
Web Directions - Code Leaders - Hiring Juniors
radar
0
390
The Future of Rails - Take 2
radar
0
86
The Future of Rails
radar
1
90
Exploding Rails
radar
9
1.7k
Hiring Juniors
radar
2
390
The Perfect Coding Test
radar
0
100
Your First Developer Job
radar
1
95
Hiring Juniors
radar
2
250
Other Decks in Programming
See All in Programming
Git Lint
bkuhlmann
4
740
Tailwind CSSを本気でカスタマイズする方法
fsubal
9
3.3k
二郎系ラーメンのコールで学ぶ AST 解析
memory1994
PRO
7
1.7k
データアナリストが行うDatabricksを活用したETLの自動化事例
shinoa
0
260
CQRS/ES avec Symfony, c’est (trop) bien !
jeremyfreeagent
1
630
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
160
Front-end application development, Symfony-style(s)
dunglas
2
1.9k
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
180
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
350
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
500
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
240
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
250
Featured
See All Featured
A designer walks into a library…
pauljervisheath
199
23k
Debugging Ruby Performance
tmm1
70
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
258
12k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
646
58k
Docker and Python
trallard
33
2.7k
How to Ace a Technical Interview
jacobian
272
22k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
990
GraphQLとの向き合い方2022年版
quramy
31
12k
It's Worth the Effort
3n
180
27k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
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