Oracle Blog

Blog for dkumar

Using JConsole

Using the jconsole tool
J2SE 5.0 has comprehensive monitoring and management support. Among the tools
included in the JDK download is a Java Management Extensions (JMX)-compliant monitoring
tool called jconsole. The tool uses the built-in JMX instrumentation in the Java Virtual
Machine to provide information on performance and resource consumption of running
applications. Although the tool is included in the JDK download it can also be used to monitor
and manage applications deployed with the Java 2 Platform Standard Edition Runtime
Environment 5.0 (JRE 5.0).
Jconsole can attach to any application that is started with the JMX agent. A system property
defined on the command line enables the JMX agent. Once attached jconsole can be used to
display useful information such as thread usage, memory consumption, and details about
class loading, runtime compilation, and the operating system.

Figure jconsole Summary tab
The Summary tab provides the following information
– Uptime: how long the JVM has been running
– Total compile time: the amount of time spent in runtime compilation
– Process CPU time: the total amount of CPU time consumed by the JVM

Figure jconsole Memory tab
The Memory tab shown in above Figure provides the following information.
– Current heap size: Number of Kbytes currently occupied by the heap
– Committed memory: Total amount of memory allocated for use by the heap
– Maximum heap size: Maximum number of Kbytes occupied by the heap
– Objects pending for finalization: Number of objects pending for finalization
– Garbage collector information: Information on GC, including the garbage collector
names, number of collections performed, and total time spent performing GC
A view of the memory pictured in above Figure shows two events of interest. At
02:20 a garbage collection was triggered from the Jconsole tool. At 02:50 an
OutOfMemoryError was thrown by an application.

Figure jconsole Threads tab

Figure Thread detail

The Threads tab shown in above Figure provides the following information.
– Live threads: Current number of live daemon threads plus non-daemon threads
– Peak: Highest number of live threads since JVM started
– Daemon threads: Current number of live daemon threads
– Total started: Total number of threads started since the JVM started (including
daemon, nondaemon, and terminated)
The Classes tab provides the following information.
– Current classes loaded: Number of classes currently loaded into memory

– Total classes loaded: Total number of classes loaded into memory since the JVM
started, including those subsequently unloaded
– Total classes unloaded: Number of classes unloaded from memory since the JVM
started

Figure jconsole VM tab
The VM tab shown in above Figure provides the following information.
– JVM type and version
– Uptime
– VM command line arguments
– Class, Library, and Boot Class paths
– JIT Compiler
– Operating System information
In addition to monitoring, jconsole can be used to dynamically change several parameters in
the running system. For example, the setting of the -verbose:gc option can be changed so
that garbage collection trace output can be dynamically enabled or disabled for a running
application. You can also perform a GC by clicking the Perform GC button on the Memory
tab.
Getting started with jconsole
1. Start the application with the -Dcom.sun.management.jmxremote option. This option sets
the com.sun.management.jmxremote system property which enabled the JMX agent.
2. Start Jconsole with the jconsole command. Jconsole ships as a binary in the
$JAVA_HOME/bin directory. (JAVA_HOME indicates the home directory of the J2SE
installation. For example, /opt/IBM/WebSphere/AppServer/java/bin)

Figure Jconsole Connect to Agent dialog box
3. When Jconsole starts it shows a window with the list of managed VMs on the machine as
shown in Figure 9-12. The process-id (pid) and command line arguments for each VM are
printed. Select a VM, click Connect, and Jconsole will attach to it.
For more information on the monitoring and management features, and details on how to use
Jconsole, read the following document.
http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html

You will see a "Generic JVM arguments" label and also will have a text box following that. That is the place to have this entry.
Or else I would go to server.xml and in genericJvmArguments="" entry I would add this.

Classes won't get unloaded unless a classgc takes place. But after running it for sometime you may have finally all the classes loaded. If you have -Xnoclassgc then classes won't be garbage collected even if they are not needed.

I was trying to use IBM's jconsole application to monitor some custom MBeans developed inhouse which are used to instrument (view and update) some application specific configuration data maintained in an Oracle DB. Our application(s) are hosted in a WebSphere Process Server 6.1 environment. I somehow do not see those MBeans in the MBeans tab of jconsole. What additional setup is requried to enable this? I am able to invoke the custom MBeans just fine using the wsadmin command line utility. We are just looking at jconsole from the perspective of provding a barebones UI to view and change the data using the custom MBeans.

I started Jconsole well and well to connect to a distant machine but the problem it is that certain function is inactive as the parameters memorials, the thread, the units of execution, the classes java and the general presentation
Although I have parameters well the parameters generic to the server's level, the management.proprieties files and the classPath

I started Jconsole well and well to connect to a distant machine but the problem it is that certain function is inactive as the parameters memorials, the thread, the units of execution, the classes java and the general presentation
Although I have parameters well the parameters generic to the server's level, the management.proprieties files and the classPath