April 2013
« Mar   May »

Monitoring JVM runtime statistics on JAVA application

One of the recent application release starting to keep the server load high after few hours of run and we are getting similar errors in log file [ My webserver is Glassfish Community version Build 5]

Interrupting idle Thread: http-thread-pool-443. To start further investigation, I would prefer to check the JVM consumption and would like to take the thread dump and heap dump.

How to monitor JVM activity running on remote servers. I found VisualVM and Jtop are useful for analyzing these issue.

Scenario : All the application servers are in remote and I do not have VPN access.

Configuring VisualVM.

In order to monitor the JVM activities on remote sever we need to establish a ssh tunnel toward the Glassfish JMX port. JMX provide admin access to manage and monitor the application server from remote location. Default JMX port value in Galssfish is 8686. I uses putty to establish the tunnel. Look at the below screen to initiate the tunnel.

next you need to download the VisualVM from Java website. Can get it from here Unzip it and open bin folder and you may see the binary file visualvm.exe there. Pls ensure that you have JJDK installed and added the JAVA binary folder in your system path variable.

Now double click to launch the application and you will see a login screen like this,

Now you need to connect a JMX host to start monitoring the JVM activity

a. Click on “local” shown at the top left side of the window and right click the mouse and choose “Add JMX Connection”
b. A popup windows will be show and input the hostname/IP and access details
Hostname : localhost ( since we are using ssh tunnel to remote host)
port : 8686 ( Default JMX port in Glassfish)
Glassfish admin details : admin/XXXXXXX

By default Heapdump option is disabled. If you want to enable it just right click on your JMX connector properties and enable the option “Enable Heapdump on OOME”/ See the screen below,

Here are few sample output which I’m getting from the remote server,

Lol.. You’ve been connected to JMX remote console and ready to start monitoring, few screen are pasted below,

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>