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
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
250
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.9k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
6.1k
Oxcを導入して開発体験が向上した話
yug1224
4
290
AIで効率化できた業務・日常
ochtum
0
110
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.3k
AIエージェントの隔離技術の徹底比較
kawayu
0
470
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.5k
今さら聞けないCancellationToken
htkym
0
220
Lessons from Spec-Driven Development
simas
PRO
0
150
AI時代のUIはどこへ行く?その2!
yusukebe
19
6.8k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
180
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
130
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
Automating Front-end Workflow
addyosmani
1370
210k
Paper Plane
katiecoart
PRO
1
51k
Optimizing for Happiness
mojombo
378
71k
Crafting Experiences
bethany
1
170
Mobile First: as difficult as doing things right
swwweet
225
10k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.3k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Writing Fast Ruby
sferik
630
63k
The Limits of Empathy - UXLibs8
cassininazir
1
350
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
600
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