JDK Mission Control (JMC) is now available as a module in Fedora 29. JDK Mission Control is a powerful profiling application for HotSpot JVMs. It has an advanced set of tools that enables efficient and detailed analysis of the extensive data collected by JDK Flight Recorder (JFR). JMC requires JDK 8 or later.



JFR is part of the JVM, and is available in OpenJDK 11 or Oracle JDK 7u4 or later. Therefore, to generate a flight recording to be loaded into JMC for analysis, the target application needs to run on OpenJDK 11 or OracleJDK 7u4 or later.

This article is a guide to install and run JMC on Fedora 29 Workstation. Then you’ll learn how to use it to solve a common problem with Java programs called hot methods.

Installing JMC on Fedora 29

Using Java 11 will allow JMC to record JFR data for itself. Install Java 11 via:

$ sudo dnf install java-11-openjdk

Enable and install the JMC module with the default profile via:

$ sudo dnf module install jmc:latest/default



Run JMC targeting the Java 11 JRE via:

$ jmc -vm /usr/lib/jvm/jre-11/bin



Using JMC and JFR to explore hot methods

JDK Mission Control can be used to deeply analyze Java applications. In this example, we will take a look at hot methods. Hot methods are methods where a high proportion of time is spent during execution. These are good places to start investigating when trying to reduce overall execution time.

To demonstrate, here is a portion of code for a Java application.

Initiator Sample Code

In practice, there are multiple methods of analyzing Java applications in JDK Mission Control. As an example, you can run the application with Flight Recording enabled and set to dump on JVM exit. This generates a Flight Recording (.jfr) file when the application exits, which can be opened by JDK Mission Control. Note that Flight Recorder is available in OpenJDK 11+ and OracleJDK 7u4+.

For example, for OpenJDK 11+ use this command to run the class with Flight Recorder:

$ java -XX:+FlightRecorder -XX:StartFlightRecording=dumponexit=true,filename=initiator.jfr Initiator

After the application has completed execution, open the resulting Flight Recording with JMC. Below is the automated analysis results.

Automated Analysis Results



The automated Method Profiling analysis already indicates a potential optimization area in the calls to Integer.equals(Object). Going to the Method Profiling tab, select that method and check the Stack Trace for it as shown below.

Method Profiling View

In this Stack Trace, you can follow the calls to the method Initiator.countIntersection(Initiator). Checking the Initiator class, shown below, note that counting intersections between two Integer collections would be better done using HashSet collections instead of LinkedLists collections.

After making this change, you can see the execution improve in the follow-up Flight Recording.

Method Profiling View of ‘After’ Code

JDK Mission Control and JDK Flight Recorder gives you a highly detailed view of your Java application behavior. You can use it to diagnose issues with hot methods, deadlocks, lock contention, memory leaks and more. Try it out via the JMC module in Fedora 29!