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
990
Let's Scale Ruby Applications with Love
Bernie Chiu
July 26, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
Why we keep our community?
kawaguti
PRO
0
290
Phase09_自動化_仕組み化
overflowinc
0
1.8k
事例から紐解くSHIFT流QA支援 ~大規模プロジェクトの品質管理支援、QA組織立ち上げ~ / 20260320 Nozomu Koketsu
shift_evolve
PRO
0
140
How to install a gem
indirect
0
1.7k
ThetaOS - A Mythical Machine comes Alive
aslander
0
200
Phase12_総括_自走化
overflowinc
0
1.6k
Phase06_ClaudeCode実践
overflowinc
0
2.2k
AI時代のオンプレ-クラウドキャリアチェンジ考
yuu0w0yuu
0
240
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
250
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
スピンアウト講座05_実践活用事例
overflowinc
0
1.3k
Navigation APIと見るSvelteKitのWeb標準志向
yamanoku
2
120
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
220
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
220
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Designing for Performance
lara
611
70k
Believing is Seeing
oripsolob
1
96
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Accessibility Awareness
sabderemane
0
84
Darren the Foodie - Storyboard
khoart
PRO
3
3k
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