Friday, March 7

Analysis of a Thread Dump



The most useful tool in analyzing a server hang is a set of thread dumps. A thread dump provides information on what each of the threads is doing at a particular moment in time. A set of thread dumps (usually 3 or more taken 5 to 10 seconds apart) can help analyze the change or lack of change in each thread's state from one thread dump to another. The pattern of a problem can only be diagnosed this way. A hung server thread dump would typically show little change in thread states from the first to the last dump.

Threads can be in one of the following states:
Running or runnable thread A runnable state means that the threads could be running or are running at that instance in time.
Suspended thread Thread has been suspended by the JVM.
Waiting for Notification A thread waits for notification from another thread. before going back to runnable state
Thread stuck waiting on a condition variable Threads in a condition wait state can be thought of as waiting for an event to occur.
Thread stuck waiting on a monitor lock Monitors are used to manage access to code that should only be run by a single thread at a time
Blocked The thread waits for completion of blocking operation (waiting I/O resource, waiting the completion of another thread, waiting to acquire the lock of an object) before going back to runnable state.

No comments:

Post a Comment