wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Help with thread dump Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Help with thread dump" Watch "Help with thread dump" New topic
Author

Help with thread dump

Hemang Jani
Greenhorn

Joined: Jan 11, 2012
Posts: 2
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.

Thanks



Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

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.

Rohan Dhapodkar
Greenhorn

Joined: Jun 27, 2011
Posts: 23
Hi Hemang,
Thread dumps obtain on windows/linux normally contain native thread id as nid= which is missing in your thread dump.
eg.


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

I learnt this in one of the training.
Niranjan Bhat
Greenhorn

Joined: Nov 15, 2009
Posts: 5
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
Greenhorn

Joined: Jan 11, 2012
Posts: 2
Thank you all for your attention.

Rohan - the nid and tid are available on Unix/Linux systems but not on thread dump taken in Windows environment


This issue is only in production environment and do not have previledge to install any profilers on the production servers.

Windows 32-bit Windows 2003
JDK 1.5

Thought to take heap dump with jmap, but jmap is not available for JDK 1.5 Windows.

Running out of ideas here.

Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help with thread dump
 
Similar Threads
Thread dump stack information in weblogic console
Two kinds of Thread dumps
Too much threads in waiting
getting stuck threads in the application
Thread stuck