Identifying Performance Issues Beyond Oracle Wait
Identifying Performance Issues Beyond Oracle Wait
11.11.15! Page 1!
About me!
Stefan Koehler!
• Independent Oracle performance consultant and researcher!
• 12+ years using Oracle RDBMS!
• Oracle performance and internals geek!
• Main interests: Cost based optimizer and Oracle RDBMS internals!
!
11.11.15! Page 3!
Systematic troubleshooting - What are
we talking about? (1)!
11.11.15! Page 4!
Systematic troubleshooting - What are
we talking about? (2)!
1. Identify performance bottleneck based on response time
Method R by Cary Millsap!
Business process is affected by
single SQL running on CPU only
11.11.15! Page 7!
Capturing “Stack traces” with focus on
Linux (2)!
• Tool “GDB” (GNU debugger) and its wrapper script pstack!
shell> gdb shell> /usr/bin/pstack <PID>
(gdb) attach <PID>
(gdb) backtrace
11.11.15! Page 8!
Capturing “Stack traces” with focus on
Linux (3)!
• Performance counters for Linux (Linux kernel-based subsystem)!
• Framework for collecting and analyzing performance data, e.g. hardware events,
including retired instructions and processor clock cycles and many more!
• Based on sampling (default avg. 1000 Hz respectively 1000 samples/sec)!
• Caution in virtualized environments when capturing cpu-cycles events (VMware
KB #2030221)!
• Tool ”Perf” is based on perf_events interface exported by Linux kernel (>= 2.6.31)!
shell> perf record -e cpu-cycles -o /tmp/perf.out -g -p <PID>
Hardware event (cpu-cycles) = Usage of kernel’s performance registers
! Software event (cpu-clock) = Depends on timer interrupt
• SystemTap (with Linux kernel >= 3.5 for userspace probing) otherwise “utrace
patch” needs to be applied!
!
11.11.15! Page 10!
Interpreting “Stack traces” with focus on
Linux!
• Performance counters for Linux (Linux kernel-based subsystem)!
• Tool “Perf”!
shell> perf report -i /tmp/perf.out -g none -n --stdio
shell> perf report -i /tmp/perf.out -g graph -n --stdio !
!Problem: Depending on the stack trace content there may be too much data to
!interpret in this format. Main question: Where is the bulk of CPU time spent?!
!
• Tool “Flame Graph” by Brendan Gregg (works with DTrace & SystemTap too)!
!shell> perf script -i /tmp/perf.out | ./stackcollapse-
perf.pl > out.perf.folded
shell>./flamegraph.pl out.perf.folded > perf-out.svg