• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Help with thread dump

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic