Java Mission Control: Flight Recordings and Heap Analysis

Java Mission Control 9.1.2 guide to analyzing Flight Recorder files and heap dumps, with UI notes, licensing guidance, and capture costs.

published: reading time: 21 min read author: Geek Workbench updated: November 20, 2026
Quick Summary

Java Mission Control 9.1.2 guide to analyzing Flight Recorder files and heap dumps, with UI notes, licensing guidance, and capture costs.

Java Mission Control: Flight Recordings and Heap Analysis

JDK Mission Control (JMC) 9.1.2 is a standalone application for analyzing Java Flight Recorder (JFR) recordings and, with the relevant plug-in, heap dumps. It is not included in every JDK. This walkthrough uses the JMC 9.1.2 interface. JFR runs inside the JVM being monitored; the JMC client is a separate download.

Introduction

JMC reads the events a JVM recorded and presents them in views such as Automated Analysis Results, Memory, Code, and Threads. The available details depend on the JFR events and settings used during capture. JMC also has a heap-dump analysis plug-in, but that view needs an existing heap dump; capturing and parsing one has separate costs.

This guide focuses on the JMC 9.1.2 analysis interface rather than recording setup.

Version and distribution

The UI labels in this article refer to JMC 9.1.2. This release requires JDK 21 or later to run, but it can analyze recordings from supported older JVMs; the JDK used to run JMC does not need to match the one that created the recording. Check Oracle’s installation requirements and release notes for supported versions. Oracle’s JMC 9.1.2 binary is a separate download and requires accepting the Oracle Universal Permissive License Agreement. The OpenJDK Mission Control source is offered under UPL 1.0 or a BSD-style license. Other vendors may package JMC under different terms, so check the license for the distribution you install. See the Oracle download page and OpenJDK Mission Control license information.

When to Use JMC / When Not to Use JMC

JMC is useful for production investigations because JFR can collect runtime events with low overhead, but the impact depends on the JDK, event settings, and workload. Measure the configuration you plan to use; the JFR guide covers that process. JMC works well for correlating application behavior with JVM events, examining JIT compilation, and identifying lock contention.

Avoid JMC when you need to profile very short-running applications—the overhead of starting the JVM itself dominates. For quick development-cycle checks during coding, lightweight tools like VisualVM or async-profiler give faster feedback. If you need allocation profiling with object retention details, YourKit or JProfiler offer more intuitive interfaces for that analysis.

JMC Architecture

graph TD
    subgraph "JMC Client"
        JMCUI[JMC 9.1.2 UI<br/>JFR Analysis]
        HDA[Heap Dump Analysis Plug-in]
    end

    HPROF[Existing Heap Dump .hprof]

    subgraph "JMX/RMI Connection"
        JMX[JMX MBean Server<br/>Remote JVM Connection]
    end

    subgraph "JVM Internals"
        FR[Flight Recorder<br/>Event Buffer<br/>Continuous/Profiling Mode]
        CP[Code Cache<br/>Compilation Events]
        GC[GC Events<br/>Heap Statistics]
        TH[Thread Events<br/>Allocation Profiling]
    end

    JMCUI <-->|"JMX/RMI"| JMX
    HPROF -->|opened in| HDA
    JMX --> FR
    JMX --> CP
    JMX --> GC
    JMX --> TH

JFR runs inside the target JVM and records configured events to a .jfr file or a bounded repository. JMC can connect to a running JVM for monitoring, or open a recording file for later analysis.

Enabling Flight Recordings

The Java Flight Recorder: Continuous Monitoring and Diagnostics guide covers startup options, jcmd commands, JMX control, recording templates, storage limits, and overhead measurement. Once you have a .jfr file, open it in JMC 9.1.2 and use the analysis views below.

Analyzing Flight Recordings

Open the .jfr file in JMC 9.1.2. The available views depend on the recording’s contents:

Automated Analysis Results lists findings such as frequent garbage collection, JVM configuration issues, and lock contention. Start here, then inspect the relevant event pages to understand a finding.

Memory view shows memory and allocation events present in the recording, along with GC information. Available details depend on the settings used during capture; an allocation trend does not show which references keep an object alive.

Code view displays the hottest methods and call trees. Sort by “CPU Usage” to find methods that consume the most CPU time. The “Compile” events show JIT compilation activity—frequent deoptimization or recompilation indicates unstable JIT optimization.

Thread view reveals thread states, lock contention, and I/O waits. The “Lock Instances” section shows which objects have threads waiting to acquire them. This is invaluable for diagnosing concurrency bottlenecks.

Heap Dump Analysis with JMC

JMC’s heap-dump analysis plug-in opens an existing heap dump; it does not remove the cost of capturing one. A dump can pause the target JVM, use substantial resources, and produce a large file. Oracle classifies GC.heap_dump as a high-impact diagnostic command and notes that heap dumps can be large. Loading and analyzing one can also take considerable memory and time, depending on the heap and analysis performed (JMC diagnostic command guidance, JDK troubleshooting preparation).

# Capture a heap dump; plan for the pause, resources, and output size
jcmd <pid> GC.heap_dump filename=heapdump.hprof

# Open the resulting .hprof file in JMC's heap-dump analysis plug-in

The dump is a snapshot of objects and references at capture time. It does not record the allocation site for every object. JFR allocation events can provide sampled allocation stacks when enabled, but they do not replace a heap dump’s retained-object graph.

Production Failure Scenarios

Scenario 1: Identifying JIT Compilation Hotspots

A latency-sensitive service shows occasional 100ms+ pauses that do not correlate with GC. Flight recorder data reveals the pauses occur during JIT deoptimization—methods that the JIT compiler optimized aggressively are being reverted. This typically happens when JIT assumptions prove wrong, like classes loading that invalidate type profiles.

The solution involves identifying the affected methods and either fixing the code that triggers deoptimization or adding guards that stabilize JIT behavior.

When deoptimization fires, the Code view in JMC groups events by method. Each event has a reason: “stack overflow,” “unloaded class,” “not entrant code,” or “type profile invalidated.” The last one is the most common—the JIT made assumptions about what types would flow through a call site, and reality disagreed. Methods with multiple “type profile invalidated” events are your top investigation targets.

The “Affected Methods” sub-view lists methods that were compiled and then reverted. The detail pane shows the compilation level before and after—methods typically drop from Level 4 down to Level 3 or 2 when deoptimized. The “Reason” field tells you exactly what broke the JIT’s assumption.

For classloading-related deoptimization, the fix usually lives in application code. If a dynamically loaded class breaks optimization of already-compiled methods, either use Class.forName() consistently in hot paths, or trigger class loading during initialization before the latency-sensitive code runs. For type profile invalidation, making call sites more type-specific helps, or using Intrinsic annotations to give the JIT clearer guidance.

A concrete case: a JSON processing service had periodic 150ms pauses. JMC showed the JSON library was loading additional converter classes on first encounter with certain event types. The fix was to preload those classes at startup. Pauses dropped to under 5ms.

Scenario 2: Separating Allocation Patterns from Retained Objects

A service runs normally for hours, then its memory use rises until it approaches the heap limit. In JMC’s JFR Memory view, check recorded allocation and GC events for patterns that coincide with the growth. Allocation events can help locate code that creates many objects, but they do not show which references keep objects alive.

To inspect retained objects, take a heap dump and open it in JMC’s heap-dump analysis plug-in. Capture and analysis can pause the application or consume substantial CPU, disk, memory, and time, especially for large heaps. A heap dump records the object graph at one point in time; it does not contain each object’s creation site. Look for unexpected retained references, such as a cache that keeps growing or a classloader that remains reachable. Use JFR allocation events when you need allocation stacks, and a heap dump when you need the retained-object graph.

Scenario 3: Diagnosing Lock Contention

An application with multiple threads shows low CPU utilization despite high load. Flight recorder data reveals threads spending significant time blocked on locks. The thread view shows which locks are contended and which code paths acquire them.

This points to opportunities for reducing lock granularity or using concurrent data structures.

JFR records every lock acquisition, release, and wait. The Thread view’s “Lock Instances” section shows each lock object, which threads acquired it, which threads are waiting, and for timed waits, how long they waited. The “Waited Time” chart ranks threads by total time spent waiting.

To find the bottleneck, sort Lock Instances by “Contentions” to see which lock is fought over most. Click into it to see the call stack of the thread that acquired it and the call stacks of all waiting threads. This tells you exactly which code path is the bottleneck, not just that contention exists.

Timed waits mean threads are giving up after a period—explicit timeout logic. Indefinite waits suggest either a signaling issue or connection pool exhaustion. Look at “Waited Time” versus “Blocked Time” to understand what is happening. High waited time but low blocked time means threads are in a wait state intentionally. High blocked time means threads are actively fighting for the lock.

Fixing lock contention depends on the pattern. If many threads are fighting over one lock, consider splitting it into multiple locks (lock striping). If the critical section is large, consider whether the lock can be held for shorter periods. If the lock protects a read-heavy data structure, ReentrantReadWriteLock or concurrent collections from java.util.concurrent may be better options.

ConcurrentHashMap replaces synchronized HashMap access with lock-free operations for most operations. BlockingQueue handles producer-consumer patterns without explicit locking. StampedLock provides optimistic read locks that reduce read contention. These structures handle synchronization internally, eliminating the bottleneck without refactoring the logic that uses them.

Trade-off Table

Feature JMC 9.1.2 / JFR async-profiler YourKit/JProfiler
Overhead Depends on events, settings, and workload 1-3% 5-15%
Allocation profiling JFR events, when enabled Yes Yes
Allocation sites Event stacks when recorded; not in heap dumps Yes Yes
Continuous recording Yes No No
Heap dumps Separate capture; analysis plug-in available No Yes
Interface quality Poor Good Excellent
Cost Separate download; check the distribution terms Free Commercial

Observability Checklist

Before considering profiling complete, verify these points. Flight recordings captured the relevant time window during actual production load. The recording settings matched your information needs—profile settings capture more detail but use more overhead. The JVM had sufficient buffer space—recording data lost to buffer overflow reduces analysis quality. You have matched the production environment closely enough that findings apply.

Also confirm that the target JVM supports JFR and that security policies allow recording access. JMC 9.1.2 runs on JDK 21 or later, while the application JVM can use an older supported JDK; check the release notes if a recording contains events the client cannot display.

Security and Compliance Notes

Flight recordings contain sensitive data. Method names, class names, and stack traces reveal application internals that you may not want exposed. The string pool in recordings can contain user data, passwords in memory, or other sensitive content.

Restrict JMX access to flight recorder MBeans. Use authentication and TLS for JMX connections in production. Do not transfer flight recordings over untrusted networks without encryption.

Compliance teams may require handling flight recordings as sensitive operational data. Include them in your data classification and handling procedures.

Common Pitfalls / Anti-Patterns

Choose default or profile settings based on the question you are investigating. profile records more detail and may use more resources; the effect depends on the workload and enabled events. The JFR guide covers the settings and how to measure their impact.

Another common error is analyzing recordings from unrepresentative periods. A recording captured during application warmup shows different behavior than steady state. Always capture recordings during actual production conditions.

Forgetting to increase the buffer size loses data. With insufficient buffer, old events are discarded before you can download them. Monitor buffer utilization when setting up continuous recording.

Finally, check the recording’s source JDK and the JMC release’s supported versions. JMC 9.1.2 can read recordings from older supported JVMs, but a newer event or file feature may not be available in an older client.

Quick Recap Checklist

  • Follow the JFR guide to create a recording with suitable settings
  • Open the .jfr file in JMC 9.1.2 and start with Automated Analysis Results
  • Run automated analysis first to identify obvious issues
  • Use Memory view for allocation patterns, Code view for CPU hotspots
  • Correlate JMC data with application logs and metrics
  • Treat recordings and heap dumps as sensitive diagnostic files
  • Check the source JVM version against JMC’s supported versions

Interview Questions

1. How does Java Flight Recorder capture profiling data with such low overhead?

Flight recorder uses event-based instrumentation inside the JVM. The JVM already tracks events like method entry, lock acquisition, and object allocation for its own operations. Flight recorder hooks into these existing code paths and writes event records to a circular buffer in native memory.

The JFR engine writes configured events to buffers in the JVM. The overhead depends on the JDK, enabled events, settings, and workload; no single percentage applies to every application. Compare the chosen configuration with a baseline under representative load. The JFR guide covers that measurement.

2. Does JMC's heap-dump analysis avoid the cost of creating a heap dump?

No. JMC analyzes a heap dump after it has been created. Capturing one with jcmd <pid> GC.heap_dump can pause the target JVM, consume resources, and write a large file; parsing a large dump can also take substantial memory and time.

A heap dump shows objects and references at capture time, but does not provide an allocation site for every object. JFR allocation events may include sampled allocation stacks when enabled; those events do not provide the retained-object graph from a heap dump.

3. What information does the JMC Code view provide for performance tuning?

The Code view shows which methods consume the most CPU time, organized by call tree. You can see not just that Method X is slow, but which call chain leads to it. The "Top Java Methods" table shows methods ranked by CPU usage. "Top Native Methods" shows native code hotspots. "Exception Check" events indicate exception handling frequency, which sometimes reveals error handling paths executing too often.

Compilation events reveal JIT behavior—methods being compiled, recompiled with different optimization levels, or deoptimized. Frequent deoptimization suggests unstable type profiles or classloading patterns that confuse the JIT compiler.

4. How do you use JMC to diagnose a thread starvation problem?

Look at the Thread view for threads in the BLOCKED or WAITING states. The "Waited Time" and "Blocked Time" charts show which threads spend the most time waiting. The "Lock Instances" section shows exactly which objects have threads blocked on them. From there, trace back to the code that owns those locks.

Check for patterns like many threads waiting on one lock, which suggests lock granularity issues. Look for threads waiting with timeouts versus indefinite waits—timed waits indicate explicit timeout logic, indefinite waits suggest possible deadlocks or connection pool exhaustion.

5. What JVM flags control flight recorder behavior?

The flags and commands depend on the target JDK. See the Java Flight Recorder guide for startup options, jcmd and JMX control, recording settings, and storage limits.

6. What is the difference between the "default" and "profile" JFR settings templates?

The default template is intended for continuous recording with less detail; profile records additional events and can have a greater impact. The exact contents and cost depend on the JDK and settings.

See the JFR guide for choosing settings and measuring their effect under representative load.

7. How does JMC's Automated Analysis Results page detect problems?

Automated Analysis uses pattern matching against known problem signatures. It identifies excessive GC frequency, long GC pauses, high allocation rates, JIT compilation issues, lock contention, and many JVM-level problems. Each finding includes the affected time range, estimated performance impact, and a suggested cause.

Run Automated Analysis first before diving into raw event data—it surfaces the most impactful issues quickly and prioritizes what to investigate first.

8. Can you use JFR with containers and Kubernetes?

Yes, JFR works in containerized environments. The JVM automatically detects container memory limits when -XX:+UseContainerSupport is enabled, which affects JFR sizing parameters.

In Kubernetes, direct JFR output to a volume mount so recordings persist beyond pod restarts. Alternatively, stream recording data through JMX using a sidecar container with JMC that connects to the JVM remotely. Ensure network connectivity and appropriate JMX authentication are configured for remote connections.

9. What does the JMC Thread view tell you about lock contention?

The Thread view shows threads organized by state (RUNNING, BLOCKED, WAITING, SLEEPING). The Lock Instances section lists every lock object with waiting threads. For each lock, you see which code path acquired it, which threads are waiting, and for timed waits, the timeout duration.

This helps identify both contention hotspots (which lock is most fought over) and the call patterns that lead to lock acquisition. The flame graph integration shows precisely which call stacks are involved in lock wait.

10. How do you configure JFR for continuous recording with file rotation?

The JFR guide covers continuous recording options, including storage limits and when to use an exit dump. Check the documentation for the target JDK before applying flags to production.

11. What information does JFR provide about JIT compilation that profiling tools cannot?

JFR records every JIT compilation event: which methods were compiled, the compilation level achieved, whether the code was later deoptimized, and why. It captures "Unknown_ADDRESS" events when compiled code addresses are flushed from memory, and "SweepCodeCache" events showing code cache management.

This detailed JIT visibility helps diagnose deoptimization-related latency spikes, identifies whether warmup is being blocked by specific compilation failures, and reveals opportunities to improve startup by controlling compilation thresholds.

12. What security considerations apply when using JFR in production?

JFR recordings contain sensitive application internals including method names like class names, stack traces, string constants, and potentially user data in the string pool. The data must be treated as highly sensitive operational data.

Restrict JMX access with authentication, use TLS for remote connections, and store recordings in secure locations with appropriate access controls. Avoid enabling settings=profile in security-sensitive environments unless actively investigating an incident.

13. How do you use JFR to diagnose problems in GraalVM Native Image?

GraalVM Native Image does not use a traditional JVM and thus does not support JFR. For Native Image applications, use alternative profiling approaches like async-profiler or GraalVM-specific tools like visualvm with GraalVM plugin. Some GraalVM Enterprise features include proprietary profiling capabilities.

If you need JFR for an application that will be compiled to native image, profile during the JVM phase before native compilation, or design the application to fall back to alternative profilers in production.

14. What is the difference between JFR event granularity and sampling frequency?

JFR records events at various granularities. Some events fire every occurrence (method entry/exit for profiled methods), while others use thresholds (exceptions only when frequency exceeds threshold). The settings=profile template increases sampling frequency across all event types, while settings=default uses thresholds to reduce overhead.

Understanding this distinction helps you tune recordings: raising thresholds reduces overhead but may miss rare events, while lowering thresholds captures more detail at higher CPU cost.

15. How does JFR handle data retention and storage in continuous recording?

Continuous recording with maxage or maxsize limits how much historical data is retained. When the limit is reached, oldest events are discarded to make room for new ones. The recording maintains a circular buffer of events up to the configured age or size.

For incident investigation, you need to dump a recording before it fills up. The jcmd JFR.dump command extracts a specific time window from a running recording without stopping it.

16. What do the JFR Memory view "Allocation in new generation" charts reveal?

The "Allocation in new generation" graph shows the rate at which objects are allocated in the young generation. Sudden spikes indicate specific application operations that allocate heavily. Comparing allocation patterns with application behavior (batch jobs, user requests) helps identify optimization targets.

High allocation rates correlate with GC pressure. If you see allocation spikes followed by frequent minor GCs, reducing allocation in hot paths can significantly improve performance.

17. How do you Correlate JFR events with application logs?

Use the timestamp or uptime from JFR events to match against application log entries. JFR events include UTC timestamps that align with standard logging timestamps. In JMC, right-click any event and select "Copy as JShell command" to capture the event details including timing.

This correlation is essential for diagnosing incidents where you need to understand what the application was doing when a JFR-detected issue occurred.

18. What is the "Environment" tab in JMC and what does it show?

The Environment tab shows JVM and system configuration at the time of the recording. It includes JVM flags in effect, Java version and vendor, OS version, CPU count, and container memory limits if applicable. This context is critical for reproducing issues—you need to know what settings were active.

Always capture this information when filing bug reports or investigating issues, as the same application can behave differently under different JVM configurations.

19. How do you identify memory leaks using JFR's Memory view?

Look for a pattern where heap usage grows continuously over time without corresponding decreases after GC events. The "Heap" graph shows used vs. committed memory. The "GC Causes" graph shows which GC events occurred. If you see constant Full GCs followed by heap not decreasing significantly, you have a memory leak.

Use the allocation profiling in the Memory view to see which code paths allocate the most memory, then trace what should be holding onto that memory.

20. What should I check before downloading JMC?

Check the JMC version, the JDK required to run it, and the terms for the distribution you plan to install. Oracle's JMC 9.1.2 download has an Oracle Universal Permissive License Agreement; the OpenJDK source is offered under UPL 1.0 or a BSD-style license. See the Oracle download page and OpenJDK Mission Control project.

Further Reading

Conclusion

JMC 9.1.2 is a separate application for inspecting JFR recordings and heap dumps. Open a recording in JMC and start with Automated Analysis Results, then inspect Memory, Code, or Threads for the events relevant to the problem. For recording setup and overhead measurement, see the Java Flight Recorder guide.

Heap-dump analysis requires an actual dump. Capture and parsing can both use substantial resources, and a heap dump does not contain allocation stacks for every object. Use JFR allocation events for recorded allocation stacks and a heap dump when you need to inspect retained objects.

Category

Related Posts

Deoptimization Debugging: When JIT Compiled Code Reverts

Learn what causes the JVM to deoptimize JIT-compiled code, how to detect deoptimization events, and how to fix the underlying issues.

#jvm #jit #deoptimization

Java Flight Recorder: Continuous Monitoring and Diagnostics

Learn Java Flight Recorder setup, storage limits, overhead measurement, and practical analysis with Oracle JDK 25 and JMC 9.1.2.

#jvm #java #profiling

JVM Flags: Standard, -X, and -XX Options Explained

Learn how standard, -X, and -XX JVM flags differ, which options apply to HotSpot JDK 26, and how to measure and roll back tuning changes safely.

#jvm #performance #tuning