Performance triage

Performance triage (David Dice’s Weblog)

Lets say I have a running application and I want to better understand its behavior and performance. We’ll presume it’s warmed up, is under load, and is an execution mode representative of what we think the norm would be. It should be in steady-state, if a steady-state mode even exists. On Solaris the very first thing I’ll do is take a set of “pstack” samples. Pstack briefly stops the process and walks each of the stacks, reporting symbolic information (if available) for each frame. For Java, pstack has been augmented to understand java frames, and even report inlining. A few pstack samples can provide powerful insight into what’s actually going on inside the program. You’ll be able to see calling patterns, which threads are blocked on what system calls or synchronization constructs, memory allocation, etc. If your code is CPU-bound then you’ll get a good sense where the cycles are being spent.