Fixing Performance & Memory problems
summary
Shows concrete fixes: use Ruby-Prof to find an N^2 hotspot in scale_factor that calls abs a quarter‑million times and get several hundredfold speedup; use low‑overhead Stackprof for production sampling; use rbtrace + ObjectSpace and write a heap dump then analyze with heapy to find millions of leaked compiled template methods created with random names inside per‑request view resolvers, a leak that exhausts memory in ~2 weeks on instances serving ~3M requests/day.
AI-written summary · about
chapters (17)
- 0:00Intro
- 0:36Realtime recommender
- 4:35Ruby-Prof is a profiler
- 9:53Sampling profilers
- 11:02Stackprof
- 11:39Overhead
- 12:22Part 1 Summary
- 16:56Leaks are scary because
- 18:23At least a year
- 19:58What could be happening?
- 21:49trace_object_allocations
- 22:19The plan
- 22:53Start Tracing
- 27:292 Questions
- 28:112 kinds of Symbols
- 28:48Action View template caching
- 32:28Part 2 Summary
related talks
43mReal World Ruby Performance at Scale
37mThe Future of Ruby Performance Tooling
29mHow to Performance
38mFinding a needle in the haystack - Debugging performance issues
46mRuby Memory Management Hacks
24mRuby Performance Secrets and How to Uncover Them
42mDebugging Ruby
34mMetric Driven Development with Ruby on Rails
