0

Our java application(ear) was deployed in J Boss+Linux and We are using mod clusters and have total 8 JV M's or j Boss instances.

We could see that daily one or two of JV M's CPU utilization is reaching to 100% and making application is very slow.

I have tried to get the thread dump by using the j stack and kill Linux commands to identify the causing thread.But unfortunately JV M is not responding if CPU utilization is reaches more than 60% for these commands.

is there any easiest way to identify the thread/method/class name which is causing the issues to increase the CPU utilization?

Could anyone provide the solution asap please?

suresh
  • 3
  • 1
  • 8

2 Answers2

0

To get the stack from a hung process use jstack -F <PID>, see oracle docs

Other solutions can be found here

Community
  • 1
  • 1
gustf
  • 1,959
  • 13
  • 20
  • jstack: Target process not responding Thread 13700: (state = BLOCKED) - java.lang.Thread.sleep(long) @bci=0 (Compiled frame; information may be imprecise) - org.jboss.console.plugins.AOPLister$RefreshPoller.run() @bci=41, line=898 (Interpreted frame) Thread 13699: (state = BLOCKED) - java.lang.Thread.sleep(long) @bci=0 (Compiled frame; information may be imprecise) - org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run() @bci=22, line=1590 (Interpreted frame) - java.lang.Thread.run() @bci=11, li – suresh Mar 17 '16 at 20:29
  • HI I am getting Thread dump as above if I use the Jstack -F .How to identify which thread is causing the issue ? – suresh Mar 17 '16 at 20:30
  • I could see most of the answers are replacing openJDK with Sun.But we can't change in production. Could you please any best option how to get the thread dump and identify which thread is actually causing the issue? – suresh Mar 17 '16 at 20:33
  • I would create a number of thread dumps and compare them, normally you can see a pattern to identify the causing thread. You will see a lot of threads in wait and socket read etc, they are not the problem. The thread that cause this will probably have a longer call stack. – gustf Mar 17 '16 at 20:46
  • Could you please advise how to identify which thread is causing issue and how to search in thread dump ? – suresh Mar 17 '16 at 21:28
  • Is there any other way to get the thread dump in production application other than jstack since hotspot is not responding most of the times? – suresh Mar 17 '16 at 21:29
  • Not what I know about. And about advise I dont have more then I already gave you. Hope you can use them, and hope you find the problem – gustf Mar 17 '16 at 23:08
0

As you wrote the JVM is not responsive and thus there is no way to get details about executed classes/methods. Thus the answer to "is there any easiest way" would be "NO". ;-)

But maybe it can help you or anyone else (questions was asked 2.5 years ago) what I would do in this case:

  1. Identify the linux thread (I use the small linux tool "threadcpu" for this).
  2. Do an strace on the found PID - maybe with longer strings ("-s 1024").

This could give you a hint which class/method is currently executed. If you see e.g. many hundreds SQL queries only used in one single class then this could help you a lot.

"threadcpu" can be downloaded from here: tuxad.com

reichhart
  • 813
  • 7
  • 13