We had a Java app that showed 100% CPU usage all the time. I was trying to find out if there were a few dominating threads when I noticed some strange results with the top
command.
If I run top
, it showed one java process that had the 100% CPU time. Then I typed H
to show threads, it started with showing several Java threads each with 100%. However, the next refresh, it showed a different batch of several Java threads again each with 100% CPU. The next refresh, another batch. This went on and on with several refresh cycles going through 100 or so threads of 100% CPU. Finally it settled down with a dozen or so Java threads each had about 10% CPU time. This "final" set of threads were the same threads that showed 100% CPU time once at the beginning but now they each had 10% only. If run top -H
directly, I got to the final set directly.
My intuition is that the 100% CPU for the Java threads was somewhat bogus. But I just couldn't find an explanation for it.
I am on a Debian Wheezy box.