Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with thread dump

 
Hemang Jani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic