6 Real-time JMX Monitoring

Java Management console (JMX) connects to a running JVM and collects and displays key characteristics in real time. It is a tool for monitoring and managing a running JVM instance. The tool presents live data about memory and CPU usage, garbage collections, thread activity, and so on. It also includes a fully featured JMX MBean browser that you can use to monitor and manage MBeans in the JVM and in your Java application.

Overview Tab

To start the JMX Console, right-click the required JVM in JVM Browser and select Start JMX Console.

By default, the JMX Console displays the Overview tab with the JMX Data Persistence Settings and Dashboard panels. It also displays the Processor and Memory charts.

The default dials on the Dashboard show information about memory utilization, CPU usage in the JVM, and live set and fragmentation.

The Overview tab allows you to add, remove, and edit dials and charts.

Adding or Editing a Dial

Click Add attributes, the plus (+) button in the top right corner of the Dashboard panel. For example, when the dialog opens, in the Filter: text field, enter FreePhysicalMemorySize and click Finish. A Free Physical Memory dial is added to the Dashboard. To edit a dial's name and its properties, right-click the dial. You can set values for the dial gradients, set the colors, and select whether you want to show the watermark.

Adding or Editing a Chart

Click Add Chart, the plus (+) button next to the Overview tab. Once the chart is added, click the Add attributes, (+) button in the top right corner of the charts panel to add the desired attribute. For example, when the dialog opens, in the Filter text field, enter ThreadCount and click Finish. A Threadcount chart is added to the page. You can right-click the attribute list and select Edit Color to change the color of the Threadcount chart. To perform other actions on the chart, such as changing its titles or exporting it as an image, use the context menu of the chart.


To reset the Overview tab, click the Reset to default controls button in the top right corner of the page.

JMX Data Persistence

You can use JMX attributes to gather persistent data and store it for analysis. JMC persists JMX data to files that you can open and view in the GUI.

Enable data persistence

The JMX Data Persistence Settings panel is collapsed at the top of the Overview tab. To enable data persistence for the attributes in the list, click the Activate JMX Data Persistence button in the top right corner of the Overview tab.

Add more attributes to the settings
To add an attribute to the list, click the Add attributes button in the top right corner of the JMX Data Persistence Settings panel. Select an attribute from the Select Attributes to Add dialog and click Finish.


To remove an attribute from the list, right-click the list and select Delete.
View the JMX data persistence file
The JMX Data Persistence data is stored in binary files in the persistence directory. By default, this directory is located in USER-HOME/.jmc/7.x.x/persisted_jmx_data. The persistence directory contains folders corresponding to the names of the JVM connections for which data persistence was enabled. Each JVM connection folder contains subfolders with names of attributes for which data persistence was enabled. These subfolders contain the log files named *.persisted_jmx_data and additional metadata files named series.info. You can drag and drop the log files to the JMX Data Persistence window to view them.


You can change the persistence directory.
  • For Windows OS, open the JMC application, select Windows, then Preferences, then JDK Mission Control, then JMX Console, and then select JMX Data Persistence. Browse to select the desired directory and apply the changes.
  • For macOS, open the JMC application, select JDK Mission Control, then Preferences, then JDK Mission Control, then JMX Console, and then select JMX Data Persistence. Browse to select the desired directory and apply the changes.

MBean Browser Tab

The MBean Browser tab allows you to monitor and manage MBeans deployed in the JMX server inside the JVM and in your Java application.

The browser provides access to all registered MBeans. An MBean can represent a device, an application, or any resource that needs to be managed. To make it easier for you to view large collection of attributes, the browser will automatically group values into subgroups. You can control this grouping by changing the preferences. For more information on MBean Preferences, see JDK Mission Control Help.

You can use the MBean browser to look at specific values of attributes, change the update intervals for attributes, add attributes to charts, and view notifications.

Create and Register a New Mbean

To create and register a new MBean, click the plus (+) button at the top of the MBean Tree panel and specify a valid object name and a class name for the new MBean in the Dynamically Create and Register a New MBean dialog. To unregister a particular MBean, right-click and select Unregister from the MBean Tree panel context menu.

Update Interval for an Attribute

To update the interval of an attribute in the Attributes table, right-click an attribute and select Change Update Interval. The update interval can be set to one of these following values:

  • Default: The default update interval setting.
  • Once: The attribute will be fetched only once. For example, you can select this interval for name of the operating system.
  • Custom: A custom update intervals specified in milliseconds (ms). For example, you can change the CpuLoad attribute to 2000 ms. In this case, the CPU load will be fetched once every two seconds.

Change the Value of an Attribute

You can update the value of an attribute only if it is rendered in bold font. For example, select MemoryPool and then Compresses Class Space MBean and go to the Attributes subtab. From the list, right-click the UsageThreshold attribute (note that this attribute is in bold font). You can either double-click the Value field or right-click and select Change Value to change the threshold value.

Visualize an Attribute
To visualize an attribute as a chart in the Overview tab follow these steps:
  1. Select any attribute from the MBean Tree panel. For example, from java.lang select Threading.
  2. In the MBean Features panel, right-click ThreadCount and select Visualize.
  3. In the Create Chart dialog, click Add Chart and enter a new name for the chart.
  4. Click OK.

    The ThreadCount chart is added to the Overview tab.


If an attribute has a boolean value, you cannot visualize it as a chart.
View Notifications

The Notifications subtab enables you to view JMX notifications available on a selected MBean. Not all MBeans provide such information, and you have to subscribe to the notifications (if they are available). For example, select the GarbageCollector MBean under java.lang and then select G1 Old Generation. Go to the Notifications subtab and select the Subscribe check box. Notifications are added to the Log panel as a separate entry to the table with the name, which comprises of the date and time of the notification. Expand the entries to view the details of the notifications.

Invoke Diagnostic Commands

You can use the MBean Browser tab to invoke diagnostic commands. For example, click the Operations subtab and then select Diagnostic Command from the com.sun.management domain. From the list of commands, select the vmInfo : String command and click Execute. The result displays in an output panel.

Triggers Tab

The Triggers tab enables you to define and activate rules that trigger events when a certain condition is met.

The rules consists of the following components:

  • Condition: This specifies when to activate a trigger. For example, activate a trigger when the CPU Load exceeds 90 percent.
  • Action: This specifies what action to do when the condition is met. For example, send an email with the details or start a flight recording.
  • Constraints: Additional constraints to the trigger condition. For example, send trigger alerts only during weekdays.

The Triggers tab allows you to add, remove, rename, activate, and deactivate rules. You can export and import the rules. The Trigger Rules panel contains some predefined rules. You can make modification to these existing rules in the Rules Details panel.

Set a Trigger

Follow these instructions to set up JMC to automatically start a flight recording if a condition is met. This is useful for tracking specific JVM runtime issues.

  1. In the Triggers tab, click the Add button. You can choose any MBean in the application, including your own application-specific ones.
  2. In the Add New Rule dialog that opens, Select an attribute for which the rule should trigger and click Next. For example, select java.lang, then OperatingSystem, and then ProcessCpuLoad.
  3. Set the condition on which the rule should trigger and click Next. For example, set a value for the Maximum trigger value, Sustained period, and Limit period.


    You can select Trigger when condition is met and Trigger when recovering from condition check boxes.
  4. Select what action you would like your rule to perform when triggered and click Next. For example, choose Start Time Limited Flight Recording and browse the file destination and recording time. Select the Open automatically checkbox if you wish to open the flight recording automatically when it is triggered.
  5. Select constraints for your rule and click Next. For example, select particular dates, days of the week, or the time of day when the rule should be active.
  6. Enter a name for your rule and click Finish.

    The rule is added to the My Rules list in the Triggers Rules panel.

When you select your rule from the Trigger Rules list, the Rule Details pane displays its components in the Conditions, Attributes, and Constraints tabs. You can edit them if you wish.

System Tab

The System tab provides you with information about the resources of the system on which the JVM is running, performance attributes of the JVM, and a list of system properties.

The Server Information panel contains a list of categories with values for the server on which the JVM is running. This information is useful for debugging development and runtime problems of the application, and for filing support requests. You cannot change this general system information.

The JVM Statistics panel contains the current values for key performance attributes of the JVM. By default, the following attributes are displayed in the table:

  • Currently Loaded Class Count
  • Uptime

To add an attribute to the JVM Statistics table, click the Add attributes button in the top right corner of the JVM Statistics panel. To modify an attribute, right-click an attribute and perform operations such as, delete, update interval, and for some attributes, change the value.

The System Properties pane contains a table with keys and system properties of the JVM. This panel has a search feature, which enables you to filter system properties either by key or value. For example, to show the properties that start with java.vm, enter java.vm in the filter text box.

Memory Tab

The Memory tab enables you to monitor how efficiently your application is using memory resources. This tab focuses on heap usage, garbage collection, and active memory pools. The information provided on this tab helps you determine whether you have configured the JVM to provide optimal application performance.

The Memory tab helps you to quickly narrow down a memory leak. A memory leak occurs when an application unintentionally holds references to objects in the heap, preventing them from being garbage collected. These unintentionally held objects can grow in the heap over time, eventually filling up the entire Java heap space, causing frequent garbage collections and ultimately the program termination with OutOfMemoryError.

You can manually initiate a full garbage collection using the Run a full garbage collection button in the top right corner of the tab and then analyze the heap dump.

Heap Histogram

To display a snapshot of memory allocation on the heap per class, click the Refresh Heap Histogram button. Note that a warning message appears to let you know that this can cause some overhead. The output shows the instance count, total size, and delta for each class type in the heap. When the first heap histogram is captured, that will be the baseline, and the delta will be set to zero. Every subsequent histogram captured will show the delta to the previous histogram. If the Reset delta calculation is pressed, the currently captured snapshot will be used as baseline. If a sequence of histograms is obtained (for example, every two minutes), then you might be able to observe a trend that can lead to further analysis.

When an application experiences a java.lang.OutOfMemoryError, analyze the heap histogram to diagnose the problem. It will indicate what objects were in the memory and what size of memory they were occupying when the java.lang.OutOfMemoryError occurred.

GC Tables

The GC Tables panel contains the current values for key performance attributes of available garbage collectors, such as G1 Young Generation and G1 Old Generation. The collection count can help you to analyze various issues. For example, a high number of young collections could be the cause of a response-time problem. If the utilization of the old generation fluctuates greatly without rising after garbage collection (GC), then objects are being copied unnecessarily from the young generation to the old generation.

Right-click an attribute to update interval, units, and for some attributes, change value.

Active Memory Pools

Memory shortage is the main reason for increased GC activity. Therefore, it is important to monitor utilization of the different memory pools (Eden, Survivor, and Old). You can achieve this by analyzing the Active Memory Pools panel, which displays information about memory pools available to the JVM.

Threads Tab

The Threads tab contains information about running threads in your application.

Live Thread Graphs

Click Live Thread Graph to view the number of threads started by the Java application. The graph contains the following attributes, by default:

  • Daemon Live Thread Count: Displays the number of live daemon threads.
  • Peak Live Thread Count: Displays the number of peak live threads.
  • Total Live Thread Count: Displays the total number of live threads.

Add More Attributes to the Graph.

To add more attributes to the Live Thread Graph, click the Add attributes button. From the Select attributes to add dialog, add the required attributes. For example, add DeadlockedThreadCount and click Finish.

Live Threads Table

All available threads are listed in the Live Threads table, with information such as thread name, thread state, and blocked count. To filter the threads in the table, enter the filter string in the filter text box. For example, enter AWT to view all the AWT threads.

Monitor Threads in real time

To monitor the threads in real time, select the CPU Profiling, Deadlock Detection, and Allocation check boxes. All these check boxes are disabled by default as enabling them consumes a lot of system resources.

Show or Hide Columns in the Table

To add more columns, right-click a thread name and select Visible Columns. From the list, select the columns you want to show or hide.

Stack Trace

If a thread is selected, its stack trace will appear in the Stack Traces for Selected Threads panel. The stack trace contains the call path for all methods up to the one that is currently executed to help you detect the method that caused an issue.

Diagnostic Commands

The Diagnostic Commands tab lists the commands that you can send to a running JVM.

The commands enable you to monitor the efficiency and performance of your Java application. They also help you to obtain information about the performance statistics, Java Flight Recorder (JFR), memory usage, garbage collection, thread stacking, and JVM runtime of the target Java application.

You can find the diagnostic commands in the Operations list and configure their parameters to the right. To run it, select a command from the Operations list, enter its argument value or values, and click the Execute button. The result displays in an output panel.

To see the detailed description of a command, select the command in the Operations list and click the Help button.

The diagnostic commands are classified according to the performance overhead they cause when executed:

  • Standard Commands: These commands are denoted by an icon with the letter i in a circle. They provide general diagnostic information. For example, JFR.dump.
  • Advance Commands: These commands are denoted by an icon with an exclamation mark (!) in a triangle. They require more resources, can impact JVM performance, but provide more information. For example, JFR.start.
  • Internal Commands: These commands are denoted by an icon with an exclamation mark (!) in an upside-down triangle. These commands provide very detailed diagnostic information, but greatly impact the JVM performance. Their impact depends on the size and contents of the Java heap. For example, GC.heap_dump.

When you execute a diagnostic command with medium, high, or unknown impact, a warning message is displayed. You can control this setting through Preferences. Deselect the corresponding check boxes if you do not want warnings displayed for diagnostic commands with a specific impact.