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
190
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
440
Web Directions - Code Leaders - Hiring Juniors
radar
0
670
The Future of Rails - Take 2
radar
0
130
The Future of Rails
radar
1
140
Exploding Rails
radar
9
1.9k
Hiring Juniors
radar
2
460
The Perfect Coding Test
radar
0
130
Your First Developer Job
radar
1
120
Hiring Juniors
radar
2
280
Other Decks in Programming
See All in Programming
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
440
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
180
Codex の「自走力」を高める
yorifuji
0
1.2k
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
110
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
230
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
420
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
340
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
380
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
490
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
150
Featured
See All Featured
From π to Pie charts
rasagy
0
150
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
480
30 Presentation Tips
portentint
PRO
1
250
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
52k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
Bash Introduction
62gerente
615
210k
Test your architecture with Archunit
thirion
1
2.2k
Thoughts on Productivity
jonyablonski
75
5.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
190
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