If you have a Java application that is eating CPU when it isn't doing anything, just how do you establish what it is doing?

I am calling a supplier is Java API, and also on some web servers it shows up that the JVM enters into a reduced top priority ballot loop after logging right into the API (CPU at 100% use). The very same application on various other web servers does not show this actions. This takes place on WebSphere and also Tomcat. The setting is complicated to set up so it is hard to attempt to do something like profiling within Eclipse.

Exists a means to account (or a few other method of evaluating) an existing Java application running in Tomcat to figure out what approaches are being implemented while it remains in this spinwait sort of state? The application is just implementing one method when it enters this state (supplier is method). Supplier can not reproduce the actions (certainly).


Update :

Using JConsole I had the ability to establish that was running and also what they were doing. It took me a couple of hrs to after that identify why it was doing it. The trouble wound up being that the supplier is API container that was being made use of did not match specifically to the the data source arrangement that it was making use of. It was failing to having mapping and also efficiency surveillance made it possible for on the web servers that had the mild mis - suit in arrangement. I made use of a various container and also all is well.

So many thanks, Joshua, for your solution. JConsole was exceptionally very easy to arrangement and also make use of to check an existing application.

@Cringe - I did some trying out several of the alternatives you recommended. I had some troubles with obtaining JProfiler set up, it looks excellent (yet costly). Moving forward I proceeded and also included the Eclipse Profiler plugin and also I'll be evaluating the various open resource profilers to contrast capability.

0
2019-12-02 03:04:28
Source Share
Answers: 3

If you are making use of Java 5 or later on, you can connect to your application making use of jconsole to watch all running strings. jstack additionally will certainly do a pile dump. I assume this need to still function also inside a container like Tomcat.

Both of these devices are consisted of with JDK5 and also later on (I think the procedure requires to be at the very least Java 5, though I can be incorrect)

Update : It is additionally worth keeping in mind that beginning with JDK 1.6 upgrade 7 there is currently a packed profiler called VisualVM which can be released with 'jvisualvm'. It resembles it is a java.net project, so added details might be readily available at that web page. I have not utilized this yet however it looks valuable for even more significant evaluation.

Hope that aids

0
2019-12-03 04:36:21
Source

Facing the very same trouble I made use of YourKit profiler. It is loader does not turn on unless you in fact connect to it (though it does open a port to pay attention for links). The profiler itself has a wonderful "get quantity of time invested in each method" while operating in it is much less interfering setting.

An additional means is to identify CPU load (using JNI, so you would certainly require an exterior collection for this) in a "watchdog" string with highest possible top priority and also start logging all strings when the CPU is high sufficient for an enough time time. You could locate this article enlightining.

0
2019-12-03 01:57:39
Source

If it is for specialist objective and also you have some cash to invest, attempt to get your hands on JProfiler. If you simply intend to get some understandings, experiment with the Eclipse Profiler Plugin. I utilized it numerous times, yet I do not recognize the existing state.

A new (?) task from the eclipse task itself is readily available also : http://www.eclipse.org/tptp/ (See this article). Never ever utilized it, so I can not inform if it deserves the initiative.

There is additionally a great checklist of open resource profilers readily available at http://www.manageability.org/blog/stuff/open-source-profilers-for-java

0
2019-12-03 00:20:59
Source