JConsole

JConsole is another Java profiling tool. It compiles to Java Management Extension (JMX) specifications. JConsole extensively uses instrumentation in JVM to collect and display information about the performance and resource consumption of applications running on the Java platform. JConsole is updated to a GNOME and Windows look and feel in Java SE 6.

Similar to VisualVM, JConsole comes bundled with the Java development kit. The executable file for JConsole can be found in the JDK_HOME/bin directory. JConsole can be started from the Command Prompt or console window with the following command:

jconsole

Upon executing the preceding command, JConsole presents the user with a choice of all of the Java applications running on the system. We can choose to connect to any running application.

It is also possible to supply the process ID, if we know the process ID of the Java application that we want JConsole to connect to. The following is the command to boot JConsole up, with a connection to a specific Java application identified by its process ID:

jconsole <process-id>

The following command can be used to connect to a Java application running on a remote machine:

jconsole hostname:portnumber

JConsole presents information in the following tabs:

  • Overview: This tab displays information about the JVM and values to be monitored. It presents the information in a graphical monitoring format. The information contains overview details on CPU usage, memory usage, thread counts, and the number of classes loaded in JVM.
  • Memory: This tab displays information about memory consumption and usage. The memory tab contains a Perform GC button, which can be clicked to activate immediate garbage collection. For the HotSpot Java VM, the memory pools are Eden Space, Survivor Space, Tenured Generation, Permanent Generation, and Code Cache. It is possible to display various charts for depicting the consumption of memory pools.
  • Threads: This tab displays information about thread usage. The threads include active threads, Live threads, and all threads. The chart's representation shows the peak number of threads and the number of live threads on two different lines. MXBean provides other information not covered by the Threads tab. With MXBean, it is possible to detect deadlocked threads.
  • Classes: This tab displays information about classes loaded in the Java virtual machine. The class information includes the total number of classes loaded so far, including those which are unloaded later on and the current number of classes loaded.
  • VM: This tab displays statistical information about the Java virtual machine. The summary includes uptime, indicating the amount of time since the JVM started; the process CPU time, indicating the amount of CPU time that JVM has consumed since it started; and the total compile time, indicating the time spent on the compilation process.
  • MBeans: This tab displays information about MBeans. The MBeans include those currently running. We can get MBeanInfo descriptor information by selecting the MBean.

Following screenshot shows how the JConsole dashboard looks like:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset