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
950
Let's Scale Ruby Applications with Love
Bernie Chiu
July 26, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
ピープルウエア x スタートアップ
operando
1
2k
GTC 2025 : 가속되고 있는 미래
inureyes
PRO
0
150
現場の壁を乗り越えて、 「計装注入」が拓く オブザーバビリティ / Beyond the Field Barriers: Instrumentation Injection and the Future of Observability
aoto
PRO
1
890
AIの個性を理解し、指揮する
shoota
3
620
DMMの検索システムをSolrからElasticCloudに移行した話
hmaa_ryo
0
350
Open Table Format (OTF) が必要になった背景とその機能 (2025.10.28)
simosako
3
620
激動の時代を爆速リチーミングで乗り越えろ
sansantech
PRO
1
240
可観測性は開発環境から、開発環境にもオブザーバビリティ導入のススメ
layerx
PRO
4
2.6k
JAWS UG AI/ML #32 Amazon BedrockモデルのライフサイクルとEOL対応/How Amazon Bedrock Model Lifecycle Works
quiver
1
740
Raycast AI APIを使ってちょっと便利なAI拡張機能を作ってみた
kawamataryo
0
240
dbtとAIエージェントを組み合わせて見えたデータ調査の新しい形
10xinc
7
1.8k
プロダクト開発と社内データ活用での、BI×AIの現在地 / Data_Findy
sansan_randd
1
780
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
8
330
Product Roadmaps are Hard
iamctodd
PRO
55
11k
How to train your dragon (web standard)
notwaldorf
97
6.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
Balancing Empowerment & Direction
lara
5
710
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
192
56k
Raft: Consensus for Rubyists
vanstee
140
7.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Scaling GitHub
holman
463
140k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
Building a Modern Day E-commerce SEO Strategy
aleyda
44
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