Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Debugging and Profiling Rails App
Search
David Paluy
January 28, 2013
How-to & DIY
250
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Debugging and Profiling Rails App
Overview of Debugging and Profiling tools for Rails
David Paluy
January 28, 2013
More Decks by David Paluy
See All by David Paluy
Your LLM Changed. Did it Get Better?
dpaluy
0
3
LLM Telemetry & Evals as First Class Rails Concerns - BlueRidgeRuby 2026
dpaluy
0
68
Tools to help you better understand the code
dpaluy
0
160
Ruby On Rails coding conventions, standards and best practices
dpaluy
1
1.5k
Faster on Rails
dpaluy
2
240
How to Prepare 3 min Fundraising Presentation
dpaluy
0
1k
Other Decks in How-to & DIY
See All in How-to & DIY
M5StickS3触ってXiaoZhiAI触ってみた #にぼし香 #iotlt
n0bisuke2
0
320
サイボウズには100名以上の社員が出演する"夏フェス"があるって本当?
oguemon
1
1k
Kernel/VM探検隊@関西 12回目 イベント会場から懇親会会場までの道のりマップ
fadis
0
110
[JAWS DAYS 2026 | Track B] Local Roots, Global Reach
awsjcpm
0
140
2026.6.27 お誕生日会で配布された透明シェルを交換する際の注意点について
mongonta0716
0
250
高校生の時にLINEDCに出会って、 気づけば大学を卒業します!!
inoue2002
0
120
JAWS/AWS Community Updates in JAWS-UG富山 at 富山高専
awsjcpm
0
130
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
2.1k
EjecTea 2026 / 20260228-osc26tk-ejectea
akkiesoft
0
1k
あなたの知らないGarageBandの世界
cheebow
0
260
OpenClawハンズオンでのトラブルとデバイス向けなんちゃらクロー #IoTLT vol133
n0bisuke2
1
310
QGIS in Your Language
salamanderezo
1
230
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The agentic SEO stack - context over prompts
schlessera
0
950
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
How Software Deployment tools have changed in the past 20 years
geshan
2
34k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
For a Future-Friendly Web
brad_frost
183
10k
How to Ace a Technical Interview
jacobian
280
24k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Leo the Paperboy
mayatellez
10
2.3k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Transcript
Debugging and Profiling Rails App David Paluy January 2013
None
Ruby is eating RAM
Agenda • “Winter is coming!” • Garbage Collector • Debug
Tools • Profiling Tools
The Task: Send ~30,000 e-mails
Result Before
How Ruby Works? Physical RAM Process Heap Ruby Heap Ruby
Heap Ruby Object Ruby Object Ruby Object Ruby Object Ruby Object Ruby Object
New Object allocation Free List A L L O C
A T E D F R E E
New Object allocation Free List A L L O C
A T E D
New Object allocation Free List is empty A L L
O C A T E D
New Object allocation Free List is empty – Call GC
A L L O C A T E D
GC Process • GC finds non-reachable objects and adds them
to Free List • If Free List is still empty, another Heap allocated
MRI GC • “Conservative”: any bit pattern could be a
pointer (may produce false positive) • “Stop the world”: no other Ruby code can execute during GC • “Mark & Sweep”: mark all objects in use, than sweep away unmarked objects
More Objects => Longer GC => Slow
In our case – Out of Memory!
How to Debug? • gem "pry-debugger" https://github.com/nixme/pry-debugger • gem "debugger-pry"
https://github.com/pry/debugger-pry
Tools • ObjectSpace.count_objects • GC debug - Enable heap dump
support • gdb.rb (only Linux) Note: memprof works only with Ruby 1.8
ObjectSpace.count_objects
Enable heap dump support to Ruby Install custom patched version
of ruby Usage:
https://github.com/tmm1/gdb.rb Attached to existing process and examine the HEAP
Result After
Profiling Tools • Ruby Benchmark • ruby-prof • perftools.rb (Google
perftools for Ruby)
Benchmark • gem 'benchmark_suite' https://github.com/evanphx/benchmark_suite
ruby-prof gem 'ruby-prof' https://github.com/rdp/ruby-prof
ruby-prof Measurements • process time (RubyProf::PROCESS_TIME) • wall time (RubyProf::WALL_TIME)
• cpu time (RubyProf::CPU_TIME) • object allocations (RubyProf::ALLOCATIONS) • memory usage (RubyProf::MEMORY) • garbage collections runs (RubyProf::GC_RUNS) • garbage collection time (RubyProf::GC_TIME)
perftools.rb https://github.com/tmm1/perftools.rb gem 'rack-perftools_profiler', :require => 'rack/perftools_profiler'
rack-perftools_profiler usage
KCacheGrind
Summary • More Objects => Longer GC => Slow •
Examine your HEAP • Use Tools
Q&A http://dpaluy.github.com @dpaluy
[email protected]
http://www.linkedin.com/in/davidpaluy