Debugging Ruby Performance

Aman Gupta at Frozen Rails 2011, 2011-09-21

Table of Contents

1 lsof - list open files

  • lsof -nPp <pid>

2 tcpdump - dump traffic on a network

  • tcpdump -i eth0 -s 0 -nqA <expr>
  • tcpdump -w <file> f. Wireshark

3 strace - trace system calls and signals

  • strace -cp <pid>
    • summary mode
    • -c count time
  • strace -ttTP <pid> -o file
    • tracing mode

4 ltrace - trace library calls

  • ltrace -c
  • ltrace -ttT -e

5 rbtrace - trace ruby method calls

  • rbtrace -p <pid> -m <method>
  • rbtrace -p <pid> --slow=50

6 perftools - by Google

  • pprof ruby ruby.prof --text

7 perftools.rb - perftools for Ruby code

8 rack-perftools - Rack middleware for perftools

9 GDB - the GNU debugger

  • gdb <executable>
  • gdb attach <pid>

10 gdb.rb - gdb hooks for MRI/REE (and some for YARV)

11 memprof - a heap visualizer for ruby

12 graphite - time series analytics

Date: 2012-02-02 09:29:47 CET

Author: Michael Kohl

Org version 7.8.03 with Emacs version 24

Validate XHTML 1.0