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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
6
LLM Telemetry & Evals as First Class Rails Concerns - BlueRidgeRuby 2026
dpaluy
0
73
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
250
How to Prepare 3 min Fundraising Presentation
dpaluy
0
1k
Other Decks in How-to & DIY
See All in How-to & DIY
Azure PortalのQoLを上げてたら Big Techに怒られた
horihiro
2
650
薪と薪スト
hirashun
0
110
グローバルチームでなんとかしがみつく英語コミュニケーション
yatsu
0
110
ことみんの登壇資料の作り方〜登壇はいいぞ〜
kotomin_m
6
1.1k
JAWS-UG初心者支部 JAWS-UG Updates
awsjcpm
4
160
社会人9年目の僕が贈る処世術
coco_se
1
390
人見知りな HUB おじさんが 会話のハードルを超え、 今度は誰かの踏み台になろうとする話/hub-guy-as-a-stepping-stone
aokiplayer
2
1.5k
あなたの知らないGarageBandの世界
cheebow
0
280
JAWS-UG鹿児島2.0 reboot - JAWS-UG/AWS Communitiesのご紹介
awsjcpm
0
140
JAWS SONIC 2026 オンラインでつながり、オフラインで会おう! - JAWS-UG北陸新幹線で始まった支部とコラボ
pharaohkj
1
360
ライブ感を生む 巻き込み型スライドの作り方/Create your slide like a heavy metal concert
ikuodanaka
5
1.8k
登壇資料を素早く作るための順番
kotomin_m
9
2.4k
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
Done Done
chrislema
187
17k
Test your architecture with Archunit
thirion
2
2.4k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
450
Marketing to machines
jonoalderson
1
5.9k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
Technical Leadership for Architectural Decision Making
baasie
3
600
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
530
Rails Girls Zürich Keynote
gr2m
96
14k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
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