Hi, I'm new to java and need some help analyzing the thread dump.
Any help understanding is appreciated.
Most of them are 'waiting for lock' and couple 'runnable'. Thread dump taken during off hours, but jvm usage is very high. Wondering which thead is the culprit. This is an ongoing issue.
Thread Dump taken on Windows.
You can't really tell with any certainty from a thread dump which threads are eating up the most CPU. Statistically, if one or a couple threads are gobbling up the CPU, then it's more likely that those will be the ones showing as "Running" at the instant you do the thread dump, but there's no guarantee. The only way to know for sure is with a profiler. You can get a free trial or limited version of JProfiler, JProbe, OptimizeIt, or AppPerfect, or you can use jvisualvm, which comes with the JDK.
Thread dumps obtain on windows/linux normally contain native thread id as nid= which is missing in your thread dump.
Once you have this native thread id in your java stack trace, you can use Process Explorer ( google it) tool, to identify which specific native thread of your java process is consuming the CPU. You can then correlate thread id from your native java process to your java stack trace thread (nid is hex value).
Also you can use one of the java profilers to profile your application.
In these profilers, you can checkout the thread which is running for a lot of time and taking the most of CPU or the thread which is blocking other threads.
I will recommend you to use yourkityourkit java profiler, it is very intuitive and easy to setup.
Hemang Jani wrote:Thank you all for your attention.
This issue is only in production environment and do not have previledge to install any profilers on the production servers.
You can install a profiler in your dev or other environment and tell it to remotely connect to production.
You can use JMX to remotely query your production process for all kinds of stuff, including lots of thread and memory information, such as how much total CPU time a given thread has consumed (though I though a thread dump already showed that).
You can try to make Dev or QA more like production--more load or whatever.
Otherwise all I can think of is to take lots of heap dumps and see which threads are usually running.
And finally, failing all else, you can explain to your boss that no progress is being made this way, and the only way you have left to proceed toward a solution is to install a profiler in production.
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
a bit of art, as a gift, that will fit in a stocking