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
360
Web Directions - Code Leaders - Hiring Juniors
radar
0
510
The Future of Rails - Take 2
radar
0
93
The Future of Rails
radar
1
100
Exploding Rails
radar
9
1.8k
Hiring Juniors
radar
2
400
The Perfect Coding Test
radar
0
110
Your First Developer Job
radar
1
100
Hiring Juniors
radar
2
270
Other Decks in Programming
See All in Programming
Java ジェネリクス入門 2024
nagise
0
530
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
170
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
3
1k
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
21
9k
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
3
1.1k
いかにして不足・不整合なくデータ移行したか
tjmtmmnk
1
1k
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
1.1k
Server Driven Compose With Firebase
skydoves
0
350
watsonx.ai Dojo #3 プロンプトエンジニアリング入門
oniak3ibm
PRO
0
490
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
350
現場で役立つモデリング 超入門
masuda220
PRO
12
2.6k
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
360
Facilitating Awesome Meetings
lara
49
6k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
GraphQLとの向き合い方2022年版
quramy
43
13k
A designer walks into a library…
pauljervisheath
202
24k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Testing 201, or: Great Expectations
jmmastey
38
7k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
What's new in Ruby 2.0
geeforr
342
31k
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