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
Let's Scale Ruby Applications with Love
Search
Bernie Chiu
July 26, 2019
Technology
4
980
Let's Scale Ruby Applications with Love
Bernie Chiu
July 26, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
Node vs Deno vs Bun 〜推しランタイムを見つけよう〜
kamekyame
1
560
AI との良い付き合い方を僕らは誰も知らない (WSS 2026 静岡版)
asei
1
360
The Engineer with a Three-Year Cycle
e99h2121
0
160
善意の活動は、なぜ続かなくなるのか ーふりかえりが"構造を変える判断"になった半年間ー
matsukurou
0
610
手軽に作れる電卓を作って イベントソーシングに親しもう CQRS+ESカンファレンス2026
akinoriakatsuka
0
480
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
340
チームで安全にClaude Codeを利用するためのプラクティス / team-claude-code-practices
tomoki10
7
3.5k
Web Intelligence and Visual Media Analytics
weblyzard
PRO
1
6.8k
歴史から学ぶ、Goのメモリ管理基礎
logica0419
14
2.9k
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
160
Models vs Bounded Contexts for Domain Modularizati...
ewolff
0
210
さくらのクラウドでのシークレット管理を考える/tamachi.sre#2
fujiwara3
1
200
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
0
220
Art, The Web, and Tiny UX
lynnandtonic
304
21k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Mind Mapping
helmedeiros
PRO
0
51
Practical Orchestrator
shlominoach
190
11k
Claude Code のすすめ
schroneko
67
210k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
84
Making Projects Easy
brettharned
120
6.5k
For a Future-Friendly Web
brad_frost
180
10k
Designing for humans not robots
tammielis
254
26k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Transcript
LET’S SCALE RUBY APPLICATIONS WITH ❤
WHO AM I ?
None
GitHub: berniechiu Twitter: berniechiu_tw Software Engineer @
OVERVIEW • Ruby and API • Ruby and Database •
Ruby and Network • Ruby and… just Ruby
WHAT MATTERS?
AVERAGES?
–DHH 「1000 requests that return in 5ms, and 200 requests
taking 2,000 ms, still get a respectable 170ms average」
Only Very Happy & Very Unhappy Credit from : https://www.youtube.com/watch?v=VPYP7oJJPdo
TUNE YOUR DESIRED METRICS
SO WHAT MATTERS? • Popular endpoints • Slow response times
None
RUBY WEB + API
RESTFUL ENTHUSIASM
None
None
None
EVEN MORE DATA?
• github.com/zdennis/activerecord-import • github.com/jamis/bulk_insert
ALWAYS KNOW WHAT RUNS UNDER RUBY
RUBY DATABASE + PAGINATIONS
None
Performance Impact
For example - Kaminari
None
None
None
KEEPING USER NAVIGATIONS INTACT?
Prefetched Count
None
None
None
ITERATIONS FROM ACTIVERECORD
FIND EACH FIND IN BATCHES • Memory saving • Fetch
limited rows on each batch/iteration • Won’t lock the whole table
BUT!
WORKING WITH UUID?
None
UUID V4 IS SORTABLE?
Credit from: https://www.postgresql.org/docs/9.6/uuid-ossp.html
Credit From: GitLab CE Custom Implementations
SPEED REGAIN
RUBY LIBRARIES + NETWORK
TYPES OF CACHING
SKIPPING TO…
LOCALLY FETCHED
None
None
None
WAIT…FIXED FOREVER FOR FIXED FOR A PERIOD
None
NO CODE CONNECTION IS FAST CODE
Connection Takes Time
COPE WITH USE CASES
RUBY X THREE
BENCHMARKING
TOOLS FOR PARTIAL CODE https://github.com/evanphx/benchmark-ips https://github.com/jondot/benchmark-ipsa
WHY NOT NATIVE • Only few iterations runs with Benchmark.bm
or Benchmark.bmbm • Display time factors instead and need to guess a random iteration counts
None
None
None
TEST YOUR THEORY
TEST YOUR THEORY Constantized One Time Calculation
TEST YOUR THEORY
TEST YOUR THEORY
SEQUEL GEM https://github.com/jeremyevans/sequel
EVERYONE CAN CONTRIBUTE
FLAME GRAPHS FROM API
TOOLS?
RACK MINI PROFILER
AN ISSUE?
None
None
HTML
None
None
None
None
None
None
VERIFY!
None
LOAD TEST!
BEWARE! • APIs might have different result in different params
body • Test with the most common set from online metrics or your own tracking
調效能就跟洗浴缸⼀一樣,拔掉 那個塞⼦子,⽔水很快就流光了了
HAPPY HACKING
QA