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?
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.