Monday, November 17, 2014

Monitor cpu usage per thread in java...

There is a thread on SO , from which I discovered the TopThreads plugin for JConsole:

jconsole -J-Djava.class.path=C:\Oracle\MIDDLE~1\JDK160~1\lib\jconsole.jar;C:\Oracle\MIDDLE~1\JDK160~1\lib\tools.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\wlfullclient.jar -pluginpath "c:\pierre\downloads\topthreads-1.1.jar" -debug

in the jconsole output you should see "Plugin class net.luminis.jmx.topthreads.PluginAdapter loaded."

and here you are: AWESOME!!!

Surely you can script it with ThreadJMX MBean, to create a monitoring tool, but this JConsole UI is so nice...

Also great is this trick: run TOP, then SHIFT-H, take the decimal value of the threads who eat more CPU, convert to HEX and match it to the nid in a jstack threadDump

No comments: