Introspective
Introspective

Reputation: 736

Thread Dump: What to look for to determine the thread responsible for 100% CPU?

Attempting to troubleshoot a 100% CPU consumption on a large system running hundreds of threads concurrently, I generated a thread dump with the help of this Oracle's Diagnosing a Looping Process article.

To find which thread is responsible for this high CPU consumption, I know that I should focus on on the threads that are in the RUNNABLE state, but there are dozens of them. So it is like finding a needle in a haystack.

What else should I be looking for among all those threads in the RUNNABLE state, to focus on the particular thread that is responsible for the 100% CPU consumption?

Upvotes: 1

Views: 651

Answers (2)

datsb
datsb

Reputation: 263

The Windows side of @meng's excellent answer:

  1. Run Microsoft's Process Explorer and take a screenshot of it while:
  2. Take a thread dump by Ctrl+Break at the Java process console.
  3. Spot the top CPU consuming TIDs in the 'Threads' tab of the process properties (in Process Explorer) and convert those numbers to Hex.
  4. Locate those hex numbers in the thread dump (appear as 'nid' == native id).

Upvotes: 2

meng
meng

Reputation: 105

On linux:
1. You can get the busiest thread id by command: top -Hp $(pidof java)
2. And then convert the thread id to hexadecimal: prinrf "%x\n" {the tid}
3. Now, search the hexadecimal id in the thread-dump, That is the thread that consumes the most CPU.

On other operation systems, google How to find the busiest thread in a process.

Upvotes: 2

Related Questions