RubyConf 2023 - Finding a needle in the haystack - Debugging performance issues by Puneet Khushwani

Debugging performance issues in Ruby on Rails applications by leveraging profiling tools, statistical analysis, and benchmarking to identify bottlenecks and optimize code.

Key takeaways
  • Measurement is essential to understanding performance issues, as it allows you to identify what to profile and benchmark.
  • Koopa is a Ruby on Rails application with a large codebase, used to demonstrate performance debugging techniques.
  • The importance of using profiling tools, such as Stackprof, to identify performance bottlenecks in your application.
  • GDB and tracers, statistical and sampling profilers, can be used to collect data on program execution, but have limitations and overhead.
  • The importance of ignoring the first few iterations of a profiling run and excluding them from comparison to get a more accurate view.
  • Use flame graphs to visualize program execution and identify slow methods.
  • Benchmarking is crucial to compare different versions of your application and identify performance improvements.
  • config files and environment variables can have a significant impact on performance and are often overlooked.
  • Dali, a dependency resolution system, can cause significant memory allocations and garbage collection issues.
  • Regex matches can cause performance issues if not optimized correctly.
  • Profiling tools should be used in a production-like environment to simulate real-world usage patterns.
  • Measure, profile, benchmark - a systematic approach to debugging performance issues.
  • Call stacks can help identify the relative resources consumed by a program’s subroutines.
  • Sampling profilers can provide a broader view of program execution, while tracers can provide more detailed information, but at the cost of higher overhead.