#AskMe

Monitor Java Application with JConsole

You might need to monitor your java application in order to examine the memory or CPU usage. JConsole is free and available in your JDK from version JDK 5 up.

About JConsole

Jconsole is a JMX-compliant monitoring tool.  It uses the extensive JMX instrumentation of the Java virtual machine to provide information on performance and resource consumption of applications running on the Java platform.

The JConsole interface is composed of the following six tabs:

Use Case

Java deploying with Tomcat

Configuration

To enable the jconsole, put following configuration in tomcat/bin/catalina.bat (Windows)

SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9033  
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

Here, I set the jconsole to use port: 9033

Running JConsole

D:\Apps\Java\jdk1.7.0_40\bin>jconsole
Starter Command and Its selection Application
JConsole Overview

So that each time you do some request in the application, you would see different graphic of Live Threads, CPU Usage, Memory or loaded classes; or you can check each JConsole tab to examine some performance in detail.

 

References: