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
910
Let's Scale Ruby Applications with Love
Bernie Chiu
July 26, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
LinkX_GitHubを基点にした_AI時代のプロジェクトマネジメント.pdf
iotcomjpadmin
0
160
強化されたAmazon Location Serviceによる新機能と開発者体験
dayjournal
2
150
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
2
140
rubygem開発で鍛える設計力
joker1007
1
120
CI/CDとタスク共有で加速するVibe Coding
tnbe21
0
230
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
280
BrainPadプログラミングコンテスト記念LT会2025_社内イベント&問題解説
brainpadpr
0
160
キャディでのApache Iceberg, Trino採用事例 -Apache Iceberg and Trino Usecase in CADDi--
caddi_eng
0
170
ローカルLLMでファインチューニング
knishioka
0
130
Clineを含めたAIエージェントを 大規模組織に導入し、投資対効果を考える / Introducing AI agents into your organization
i35_267
4
1.4k
白金鉱業Meetup_Vol.19_PoCはデモで語れ!顧客の本音とインサイトを引き出すソリューション構築
brainpadpr
2
490
Create a Rails8 responsive app with Gemini and RubyLLM
palladius
0
140
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Into the Great Unknown - MozCon
thekraken
39
1.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
228
22k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.4k
For a Future-Friendly Web
brad_frost
179
9.8k
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