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
0
LLM Telemetry & Evals as First Class Rails Concerns - BlueRidgeRuby 2026
dpaluy
0
61
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
画面の向こうから「気づき」を得る 画面の向こうを「物差し」として捉える
subroh0508
1
460
JAWS-UG/AWS Community Update 彩の国埼玉支部1周年記念
awsjcpm
1
180
あなたは何故コミュニティに参加するのか?
awsjcpm
3
440
なぜJAWS-UGはこんなにも活発なのか?
awsjcpm
1
280
Azure PortalのQoLを上げてたら Big Techに怒られた
horihiro
2
650
What $10 Fake AirPods and a $30 Chip Decap Reveal About China's Semiconductors
takasumasakazu
0
140
JAWS-UG/AWS Community Update - JAWS-UG栃木 #6
awsjcpm
0
150
JAWS-UG/AWS Community Update 2026年6月20日JAWS-UG FUKUOKA #26 JAWS DAYS 2026 re:Cap! おつかれせいけしろー
awsjcpm
0
150
MustをWillに変える技術 〜アイドル・郁田はるきが"すべき"の壁を超えるまで〜
subroh0508
1
2.1k
Burnoutとの「対話」 〜 アジャイルコーチングを活用した、燃え尽き症候群を克服するスキル 〜 / Dialogue with Burnout by Using Agile Coaching Skills
hageyahhoo
0
1.1k
JAWS-UG/AWS Community Update - 2026/6/13 JAWS-UG TOHOKU 仙台
awsjcpm
0
1.3k
AWS/JAWS-UG Community Updates at JAWS-UG Kagoshima
awsjcpm
0
110
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
4.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
920
Thoughts on Productivity
jonyablonski
76
5.4k
How GitHub (no longer) Works
holman
316
150k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Mobile First: as difficult as doing things right
swwweet
225
10k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
330
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
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