Knowledgebase
Monitoring Java Applications with JConsole
Posted by Mark Lucas (WANdisco) on 07 January 2010 11:20 AM

Summary: Introduction to an invaluable console tool for monitoring Java applications and virtual machines.
Applies to: All products

Purpose

Jconsole gives you information about the performance and resource consumption of applications running on the Java platform; Namely Heap Usage, CPU (total JVM not per-thread), thread info, classes loaded and garbage collection info.


JConsole 1
JConsole GUI

Architecture

The JConsole graphical user interface is a monitoring tool that complies to the Java Management Extensions (JMX) specification. JConsole uses the extensive instrumentation of the Java Virtual Machine (Java VM).

JConsole 2
JMX architecture for JSE5/6

Version Compatibility

JConsole is bundled with the Java Development Kit (JDK) in the Java SE platform version 6 update 7.

Setup

With Java SE 6 platform and above no setup is required.

The version of JConsole provided with the Java SE 6 platform can attach to any application that supports the Attach API.

On previous releases of the Java SE platform, applications that you wanted to monitor with JConsole needed to be started with the following option:

% -Dcom.sun.management.jmxremote

Location

The jconsole executable can be found in JDK_HOME/bin, where JDK_HOME is the directory in which the JDK software is installed.


To execute:

% jconsole processID	

(where JDK_HOME/bin is in your path)
processID of the application can be found from ps (Linux) or Task Manager (Windows)

Thread based CPU usage

The JTop application is a JDK demonstration that shows the CPU usage of all threads running in the application.

This demo is useful for identifying threads that have high CPU consumption, and it has been updated to be used as a JConsole plug-in as well as a standalone GUI.

JConsole 3
JTop as a plug-in

JTop is bundled with the Java SE 6 platform, as a demo application. You can run JConsole with the JTop plug-in by running the following command:

% JDK_HOME/bin/jconsole -pluginpath JDK_HOME/demo/management/JTop/JTop.jar	

References

Using JConsole to Monitor Applications - http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
Guide to using JConsole - http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
JConsole Manual page - http://java.sun.com/javase/6/docs/technotes/tools/share/jconsole.html


Last edit: mlucas 07th Jan 2010

(206 vote(s))
This article was helpful
This article was not helpful

Comments (0)
For SmartSVN support visit http://support.smartsvn.com

Copyright © 2005 - 2013 WANdisco, plc | Privacy | Terms | Trademarks