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.

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

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

Java Flight Recorder: Continuous Monitoring and Diagnostics

Java Flight Recorder (JFR) records runtime events from a JVM for later investigation. It has shipped with OpenJDK since Java 11. Its cost and file size depend on the JDK, workload, event settings, recording duration, and storage limits, so measure the setup you plan to use.

This guide explains how to choose settings, bound repository storage, and analyze a recording. The examples include a workflow using Oracle JDK 25 and JMC 9.1.2.

Introduction

JFR runs inside the JVM and can record events such as garbage collection, safepoints, allocations, JIT compilation, and lock contention. The selected settings control which events appear and what details they collect. Use the jfr command-line tool or JDK Mission Control (JMC) to inspect a .jfr file.

What is Java Flight Recorder?

JFR is a continuous monitoring tool that runs inside the JVM, capturing events about thread execution, memory allocation, garbage collection, lock contention, CPU profiling, and I/O operations. Unlike external profilers that attach to a running process, JFR lives inside the JVM runtime and sees events that external tools simply cannot access.

JFR stores data in binary Flight Recorder Files (.jfr). You analyze these afterward with JDK Mission Control (JMC), the jfr CLI, or your own code using the JFR API.

When to Use Java Flight Recorder

Ideal Use Cases

  • Production diagnostics: Continuous recording with default.jfc, after measuring its impact under representative load
  • Root cause analysis: Investigating intermittent performance issues, memory leaks, or latency spikes
  • Capacity planning: Understanding resource utilization patterns over time
  • Compliance and auditing: Maintaining diagnostic records for regulatory requirements
  • Post-incident analysis: Capturing evidence from production incidents for later review

When NOT to Use Java Flight Recorder

  • Real-time debugging: If you need to step through code or pause execution, use a debugger instead
  • Microsecond-level tracing: JFR has inherent overhead and sampling biases that make it unsuitable for ultra-precise measurements
  • Memory-constrained environments: Measure the recording’s impact and bound its repository when memory or disk budgets are tight
  • Short-lived applications: JFR works best with long-running services; cold start profiling yields limited data

Architecture

JFR consists of several interconnected components within the JVM:

graph TB
    subgraph "JVM Runtime"
        JE[JFR Engine]
        JS[JFR Settings]
        JC[JFR Configuration]
    end

    subgraph "Event Types"
        EM[Event Museum]
        EC[Event Categories]
        ET[Event Types<br/>JDK, JVM, Application]
    end

    subgraph "Collection Pipeline"
        EC -->|Filter & Process| JE
        JE -->|Buffer| JB[JFR Buffers]
        JB -->|Chunk| JC
    end

    subgraph "Output"
        JC -->|Write| JF[JFR File .jfr]
        JC -->|Streaming| JD[JDK Mission Control]
        JC -->|Streaming| JJ[JFR API Consumer]
    end

    subgraph "Configuration"
        JS -->|Settings| JE
        CP[Control Plane<br/>JMX, CLI, API] -->|Configure| JS
    end

Core Components

Event Museum: A catalog of every event type the JVM knows about. Each has predefined fields and metadata.

JFR Engine: The collection and processing core. It receives events, applies your configuration filters, and manages the circular buffer.

JFR Buffers: Thread-local buffers that batch events before consolidation. This keeps threads from contending with each other during recording.

Flight Recorder File: The output format. Uses a chunked binary structure that supports streaming reads, so you can start analyzing before the recording finishes.

Control Plane: How you talk to JFR, through JMX, command-line flags, or the FlightRecorderMXBean API.

Event Types

JFR organizes events into categories:

Category Examples Collection considerations
Garbage Collection GC pause, young/old collection, reference processing Event availability and detail depend on the JDK and settings.
Profiling CPU load, method profiling, allocation in TLAB Sampling and stack-trace settings affect detail and cost.
Memory Heap memory, TLAB allocations, object statistics Event frequency and thresholds affect recording volume.
Threading Thread start/stop, lock profiling, context switch Enable only the events needed for the investigation.
I/O Socket read/write, file I/O Event settings and workload determine what is recorded.
Exceptions Exception thrown, error count A recording contains the events enabled by its configuration.
Code Cache JIT compilation, deoptimization Inspect the event settings for thresholds and stack traces.
Language & Runtime Class loading, VM operation, safepoint Event behavior varies by event type and JDK version.

Implementation

Starting a Recording via Command Line

# Start with default.jfc settings and bounded repository retention
java -XX:StartFlightRecording=filename=myapp.jfr,settings=default,maxage=2h,maxsize=500m -jar app.jar

# Use profile.jfc for a short, targeted investigation
java -XX:StartFlightRecording=filename=myapp-profile.jfr,settings=profile,duration=60s -jar app.jar

The default.jfc settings are intended for low-overhead continuous recording. profile.jfc enables more data and can have a greater performance impact, so use it for a short, focused investigation. Neither preset guarantees a fixed overhead or file size; both depend on the JDK, workload, event settings, and recording duration. See Oracle’s JDK 25 launcher documentation for the StartFlightRecording options.

JDK 25 capture and JMC 9.1.2 analysis

Run the application with Oracle JDK 25 and generate representative activity during the capture window. For a short, targeted profile, use:

java -XX:StartFlightRecording=filename=recording.jfr,settings=profile,duration=60s -jar app.jar

After the application exits, inspect the file’s event counts and time range:

jfr summary recording.jfr

Open recording.jfr in JMC 9.1.2 and start with the recording overview, then inspect the event views relevant to the question, such as CPU samples, garbage collection, or thread activity. Record the JDK build, settings, workload, capture duration, and observed results so another run can be compared fairly. Oracle documents the JFR analysis workflow and provides the JMC 9.1.2 download. JMC 9.1.2 itself requires JDK 21 or later to run; that is the JDK used by the analysis tool and does not change the JDK 25 used to record the application. See the JMC installation requirements.

Programmatic Control via JFR API

import jdk.jfr.Recording;
import jdk.jfr.RecordingState;
import jdk.jfr.FlightRecorder;

public class JfrController {
    public void startRecording(String outputPath, Duration duration) throws Exception {
        Recording recording = new Recording();

        // Enable specific events
        recording.enable("jdk.CPULoad");
        recording.enable("jdk.GarbageCollection");
        recording.enable("jdk.ThreadPark");
        recording.enable("jdk.ObjectAllocationInTLAB");

        // Set recording duration
        recording.scheduleEnd(duration);

        // Start recording
        recording.start();

        System.out.println("Recording started: " + recording.getId());

        // Dump recording to file
        recording.dump(Path.of(outputPath));

        // Stop when done
        recording.stop();
        recording.close();
    }

    public void continuousRecording(String outputPath) throws Exception {
        Recording recording = new Recording();
        recording.enable("jdk.GarbageCollection");
        recording.enable("jdk.CPULoad");
        recording.enable("jdk.ThreadDump");

        // Bound data retained in the recording repository by age and size.
        // These limits do not predict the size of a later dump file.
        recording.setMaxSize(100 * 1024 * 1024);
        recording.setMaxAge(Duration.ofHours(10));

        recording.start();

        // Simulate continuous operation
        Thread.sleep(60000);

        recording.stop();
        recording.close();
    }
}

Dynamic Event Enabling

One of JFR’s strengths is the ability to enable events dynamically without restarting the JVM:

import jdk.jfr.*;

public class DynamicJfr {
    public void enableEventsOnDemand() throws Exception {
        // Check if Flight Recorder is available
        if (!FlightRecorder.getFlightRecorder().isAvailable()) {
            throw new IllegalStateException("Flight Recorder not available");
        }

        // Enable a specific event
        EventType eventType = EventType.getEventType("jdk.ObjectAllocationOutsideTLAB");
        System.out.println("Event ID: " + eventType.getId());

        // Create a one-time event
        Configuration profile = Configuration.getConfiguration("profile");
        System.out.println("Profile settings: " + profile.getSettings());
    }
}

JMX Control via FlightRecorderMXBean

import javax.management.*;

public class JmxJfrControl {
    public void controlViaJMX() throws Exception {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

        // Get the FlightRecorder MXBean
        ObjectName recorderName = new ObjectName("jdk.management.jfr:type=FlightRecorder");
        FlightRecorderMXBean recorder = JMX.newMXBeanProxy(mbs, recorderName, FlightRecorderMXBean.class);

        // List available recordings
        List<RecordingInfo> recordings = recorder.getRecordings();
        System.out.println("Active recordings: " + recordings.size());

        // Get recording options
        Map<String, String> options = recorder.getRecordingOptions();
        System.out.println("Buffer size: " + options.get("bufferSize"));

        // Dump a recording
        recorder.dumpSnapshot("emergency_dump.jfr");
    }
}

Diagnostic Scenarios

Scenario 1: Memory Leak in Old Generation

Symptom: Application gradually slows down, GC pauses increase over time, eventually OOM.

JFR Investigation:

# Analyze GC pauses
jfr print --events GCGarbageCollection myapp.jfr | head -50

# Check object allocation patterns
jfr print --events ObjectAllocationInTLAB,ObjectAllocationOutsideTLAB \
     --category Memory myapp.jfr

# Find largest objects
jfr print --events ObjectStatistics myapp.jfr | sort -k5 -nr | head

Example finding: Allocation and garbage-collection events can help trace a growing session cache to entries that are added but never removed. Size recordings according to the enabled events and available disk budget.

Scenario 2: Latency Spikes from Safepoint Pauses

Symptom: P99 latency spikes every few minutes, but GC logs look clean.

JFR Investigation:

# Check VM Operation events (includes safepoint)
jfr print --events VMOperation \
     --json myapp.jfr | jq '.records[] | select(.type=="safepoint")'

# Examine thread states during pauses
jfr print --events ThreadDump myapp.jfr | grep -A5 "parked"

Example finding: A time-aligned recording can show whether VM operations or compiler activity coincide with a latency spike. Treat that timing as a lead and compare it with GC logs and application metrics.

Scenario 3: Lock Contention in Request Pipeline

Symptom: Throughput plateaus under load even though CPU is not maxed out.

JFR Investigation:

# Analyze lock contention
jfr print --events JavaMonitorEnter,ObjectMonitorEnter \
     --events java.lang.Threading \
     myapp.jfr | grep -E "(address|class|duration)"

# Check for excessive park events
jfr print --events ThreadPark --events Blocked \
     myapp.jfr

Example finding: Monitor-enter and park events can show whether many threads wait on the same synchronization point. Check the event configuration and correlate the waits with throughput before deciding where to change the code.

Scenario 4: I/O Bottleneck Masking as CPU Issue

Symptom: High CPU utilization, but threads look idle under profiler.

JFR Investigation:

# Check socket and file I/O events
jfr print --events SocketRead,SocketWrite \
     --events FileRead,FileWrite myapp.jfr

# Correlate with network latency
jfr print --events SocketRead \
     --json myapp.jfr | jq '[.records[] | {duration: .duration, endTime: .endTime}] | sort_by(.duration) | reverse | .[0:10]'

Example finding: Socket read and write events can expose time spent waiting on network I/O. Compare those intervals with connection-pool and network metrics to distinguish a slow peer from local resource contention.

Trade-off Table

Aspect default.jfc profile.jfc Notes
Overhead Intended for low-overhead continuous recording Collects more data and may have greater impact Measure on the target JDK with representative load and chosen settings.
Storage Depends on enabled events and workload Can produce more data due to its event selection Set maxage and/or maxsize to bound the disk repository.
Detail level Suitable for ongoing JVM diagnostics More detail for targeted investigations Review event thresholds and stack-trace settings.
Typical use Continuous recording Short, focused capture Choose based on the question you need to answer.
Retention Configure age and/or size limits Configure age and/or size limits The oldest data is removed when a configured repository limit applies.

Observability Checklist

  • Enable JFR in production with -XX:StartFlightRecording=...
  • Configure disk space limits with maxsize and maxage
  • Set up automated recording rotation
  • Enable GC events for memory analysis
  • Enable jdk.GarbageCollection with cause and pause data
  • Enable jdk.ObjectAllocationInTLAB for allocation profiling
  • Enable jdk.CPULoad for resource monitoring
  • Enable jdk.ThreadDump for deadlock detection
  • Add dumponexit=true to StartFlightRecording when an exit dump fits the incident workflow
  • Set up external storage for JFR files (off-node)
  • Integrate JFR analysis into incident response runbooks
  • Train team on JMC (JDK Mission Control) usage
  • Create alerts for recording failures or disk space issues
  • Document known-good baseline recordings
  • Compare baseline and recording runs under representative load, then note observed throughput and latency changes with the JDK and settings used

Security Notes

A JFR file contains whatever the enabled events record. Depending on the JDK, event settings, and any custom events, that can include JVM diagnostics such as command-line options, environment variables, system properties, thread and stack details, or application-provided event values. The JDK’s diagnostic tools documentation describes the information available through JFR and related diagnostics. Do not assume that an event is safe to share simply because its setting is part of a preset.

Treat recordings as sensitive files. Write them to an access-controlled location, restrict access to recording controls such as JMX, and review a file before sharing it outside the team. Apply your organization’s retention and encryption requirements to the recording and any exported reports. Choose event settings deliberately; a recording’s contents depend on those settings, and the workflow here does not redact event values.

Common Pitfalls / Anti-Patterns

Pitfall 1: Leaving the Disk Repository Unbounded

Problem: If neither an age limit nor a size limit is configured, a recording repository can grow without bound. A limit is a retention control, not a promise about the size of a later dump file.

Solution: Configure maxage and/or maxsize for the workload and available disk. When a configured limit applies, JFR removes the oldest chunks to keep recent data. For example, this caps retained repository data by age and size:

java -XX:StartFlightRecording=filename=app.jfr,maxage=2h,maxsize=500m -jar app.jar

The JDK 25 StartFlightRecording options and Recording API document these limits.

Pitfall 2: Assuming Every Event Has the Same Capture Semantics

Problem: Treating a recording as a complete trace can lead to conclusions an event does not support. Some event types use sampling; others have thresholds or are emitted when a specific JVM action occurs. Their settings and semantics are event-specific.

Solution: Check the event metadata and configuration used by the target JDK before interpreting absence or frequency as proof that an event did or did not occur. Sampling can miss short-lived activity, while thresholds intentionally omit events below their configured limit. Use representative capture windows and record the JDK and settings alongside your analysis.

Pitfall 3: Assuming a Fixed Recording Overhead

Problem: A percentage measured on one application, JDK, or event configuration does not predict the cost on another. Overhead depends on the JDK build, enabled events, thresholds, stack-trace settings, workload, recording duration, and storage destination.

How to measure: Run the same representative workload with recording disabled and enabled, using the exact settings you plan to deploy. Compare throughput, CPU use, latency percentiles, and recording growth over the same interval. Repeat the comparison if workload variance is high. Report the observed differences together with the JDK build, event settings, workload, and duration; do not present one percentage as a general JFR guarantee.

Solution: Use default.jfc as the low-overhead continuous starting point. Use profile.jfc to collect more data during a short, targeted investigation, then measure that configuration too. Narrow the event set or adjust thresholds and stack traces if the observed impact does not fit the application’s operational budget.

Pitfall 4: Not Correlating with External Metrics

Problem: JFR data alone sometimes sends you down the wrong path.

Why this happens: JFR sees the JVM’s internal view of the world. It knows about GC pauses, thread states, and method-level CPU usage, but it has no visibility into OS-level resource contention. When your application is bottlenecked on disk I/O, CPU scheduling, or network latency at the kernel level, JFR threads show as “Running” or “Blocked” without revealing the actual cause. A thread waiting on disk I/O looks identical to a thread waiting on a lock from JFR’s perspective. Similarly, CPU steal in virtualized environments shows up as high CPU time in JFR without any way to distinguish it from actual useful work.

What to correlate: Always bring in OS-level metrics alongside JFR data. The most important ones to align:

Metric Tool What it reveals
Disk I/O utilization and throughput iostat, iotop Whether JFR thread blocks are actually disk wait
CPU steal and stolen time vmstat, cloud provider console Virtualization-level CPU contention
Network packet drops and retransmits netstat, ss NIC saturation or TCP issues
Page faults and swap activity vmstat, free Memory pressure causing disk wait
I/O wait percentage top, mpstat Distinguishes CPU-bound from I/O-bound

How to correlate effectively: Export JFR recording timestamps (start time, end time) and use those as window markers when querying your time-series database. If you see a latency spike at 14:32:15 in JFR, check system metrics at exactly that time. Most monitoring systems (Prometheus, Grafana, Datadog) let you narrow dashboards to a specific time window. When the timeline aligns, the root cause often becomes obvious: JFR shows a thread blocked on a lock, but system metrics reveal the real culprit was a disk I/O storm from a different process on the same host.

Solution: Never analyze JFR data in isolation. Keep a parallel dashboard of system-level metrics and make it a habit to check both during incident investigations.

Pitfall 5: Mixing Up the Capture JDK and the JMC Runtime

JFR runs in the application JVM; JMC is a separate analysis application. The JDK requirement for launching JMC does not dictate which JDK must create the recording. The workflow in this guide captures with Oracle JDK 25 and analyzes with JMC 9.1.2, which requires JDK 21 or later to run. Keep both tool versions with your notes and use the JMC release documentation if an event or view is not available in your installation.

Quick Recap Checklist

  • JFR is built into the JVM; measure the chosen settings under representative load
  • Enable via -XX:StartFlightRecording or programmatically via the JFR API
  • Configure maxsize and maxage to prevent disk exhaustion
  • Use documented recording options such as dumponexit=true when needed
  • Analyze recordings with JDK Mission Control or jfr CLI
  • Choose events and thresholds for the question; measure the resulting impact
  • Store recordings securely; they contain sensitive runtime data
  • Correlate JFR findings with external metrics for complete picture
  • Use dynamic event enabling for targeted investigations
  • Train team on common analysis patterns before incidents occur

Interview Questions

1. What is Java Flight Recorder and how does it differ from external profilers?

Java Flight Recorder runs inside the JVM and records configured runtime events such as garbage collection, safepoints, allocations, and JIT compilation. Its cost depends on the JDK, enabled events and settings, workload, recording duration, and storage. Measure the configuration under representative load before relying on it in production.

2. How do you configure JFR for continuous production monitoring?

For continuous monitoring, start with the low-overhead default.jfc settings and configure maxage and/or maxsize to bound the disk repository. For example: java -XX:StartFlightRecording=filename=app.jfr,settings=default,maxsize=500m,maxage=2h -jar app.jar. Measure the chosen settings with representative load, and account for the application's disk budget. When a repository limit applies, older chunks are removed to retain recent data. Add dumponexit=true only when an exit dump fits the incident workflow.

3. What are the security considerations when using JFR in production?

A recording contains the values emitted by its enabled events. Depending on the JDK, event settings, and custom events, it may include JVM diagnostics, thread and stack details, command-line options, environment variables, system properties, or application-provided event values. Treat the file as sensitive: restrict access, review it before sharing, and follow retention and encryption requirements. Do not assume a preset redacts event values.

4. How do you investigate a memory leak using JFR?

Capture allocation and garbage-collection events while reproducing the suspected leak. In JMC, use the views available for the recording to look for repeated allocation patterns, growing object populations, or collections that retain entries. The events available depend on the JDK and recording settings; compare captures over time and confirm the suspected retention path with other diagnostics before drawing a conclusion.

5. How does JFR's chunked binary format enable streaming analysis?

JFR files use a chunked binary structure that lets compatible tools read completed portions without waiting for the entire recording to finish. The recording's settings and runtime determine its contents; avoid tuning implementation options unless documentation for the target JDK describes the option and its effect.

6. What is the difference between a dump and a snapshot in JFR terminology?

A snapshot is a point-in-time copy of the current recording's data. It captures the data available at that moment. A dump (via dumpSnapshot) copies the events written so far. When you call recording.dump(Path.of("output.jfr")), it writes the recording to a file. These terms depend on the API being used, so check the relevant method documentation when interpreting a specific capture.

7. How do you correlate JFR data with external monitoring systems like Prometheus?

JFR does not directly export to Prometheus. One option is a JFR-to-metrics sidecar that reads events and exposes metrics over HTTP. Another is to run JMX Exporter alongside JFR: JMX provides numeric gauges such as heap use and thread count, while JFR provides event details. Export both to the same time-series database and align them by timestamp. Note the recording start and end times when comparing it with monitoring data.

8. How do I bound JFR repository storage?

Buffer implementation options are JDK-specific and are not recording-retention controls. For disk retention, use the documented maxage and/or maxsize settings. If neither is configured, the recording repository can grow without bound; when a configured limit applies, the oldest chunks are removed to retain recent data.

9. How does JFR handle events from the VM operation safepoint phase?

JFR has events for VM operations that occur at safepoints, including ExecuteVMOperation, which records the operation type and duration. The recording can help distinguish GC pauses from other VM operations, such as JIT deoptimization or class unloading. Check the available event names and fields for the JDK that created the file.

10. Can JFR record data from multiple recordings simultaneously?

Yes, multiple recordings can be active at once, and each has its own settings and output. Use FlightRecorderMXBean.getRecordings() to list them. Their combined impact depends on enabled events and settings, so compare the actual configuration under representative load instead of assuming costs add in a fixed way.

11. What is the JFR Event Streaming API and when should you prefer it over file-based analysis?

JFR Event Streaming (jdk.jfr.consumer API) lets you consume JFR events in real-time as they are emitted, without waiting for a file to close. You register a callback or use a RecordingFile on a live file. Use streaming when you need to: detect and respond to events in real-time (e.g., alerting on a specific GC pattern), build live dashboards, or feed events into a stream processing system. The trade-off is that streaming requires more complex code than post-hoc file analysis, and you need to handle backpressure if events arrive faster than you can process them.

12. How does JFR's "continuous" vs "profile" configuration preset differ in event detail?

The default.jfc settings are intended for low-overhead continuous recording. The profile.jfc settings collect more data and can have a greater performance impact, so use them for short, targeted investigations. Event selection and cost can vary by JDK and configuration. Compare baseline and recording runs under representative load, then report the measured result rather than a universal percentage.

13. How do you diagnose a JFR recording that fails to start or produces an empty file?

Common causes: disk space exhaustion (JFR writes a header immediately then waits for events), wrong file path permissions, and using settings=none which disables all events. Check jcmd <pid> JFR.check or the FlightRecorderMXBean for recording status. Also verify the JVM is not running with -XX:+FlightRecorder explicitly disabled. If using dynamic event enabling, the recording must be in a started state first. The jfr print command on the file can reveal if it has any events at all.

14. What is the relationship between JFR and JDK Mission Control (JMC)?

JMC is a separate application for opening and analyzing JFR recordings. In the workflow here, Oracle JDK 25 creates the recording and JMC 9.1.2 analyzes it. JMC 9.1.2 requires JDK 21 or later to run; that runtime requirement is separate from the JDK used by the application being recorded. See Oracle's JMC installation requirements and JMC 9.1.2 download page.

15. How does JFR handle sensitive data in recordings and what options exist for redaction?

Recording contents depend on the enabled events, settings, JDK, and any custom events. They may include system properties, environment variables, command-line options, thread or stack details, or application-provided event values. Treat recordings as sensitive files: restrict access and review them before sharing. Configure events deliberately and follow your organization's data-handling rules; these steps are not a redaction mechanism.

16. How does JFR work in a containerized environment with memory limits?

JFR is container-aware in modern JVMs. When running in a container with memory limits, JFR accounts for container memory when calculating default buffer sizes and recording limits. Configure appropriate maxsize for both the recording and the overall disk space since container filesystems may have stricter quotas. On Kubernetes, mount a volume for JFR output and set -XX:FlightRecorderOptions=repository=/mnt/jfr for rotating recordings. JFR auto-detects container CPU and memory limits via cgroups for proper sizing.

17. What is the difference between jcmd, jfr CLI, and FlightRecorderMXBean for controlling JFR?

jcmd sends diagnostic commands to a running JVM, including JFR commands such as JFR.start, JFR.dump, and JFR.check. The jfr CLI analyzes recording files; for example, jfr summary recording.jfr gives a first-pass summary. FlightRecorderMXBean provides programmatic control through JMX. Use the tool that matches whether you need to control a live recording or inspect an existing file.

18. How do you measure JFR overhead itself to validate it is within acceptable bounds?

Run the same representative workload with recording disabled and enabled, using the exact settings and JDK you plan to deploy. Compare throughput, CPU, latency percentiles, and recording growth over the same interval. Report the observed changes along with the workload, JDK build, event settings, and duration. There is no universal overhead percentage or acceptance threshold; use the application's operational budget to decide whether to narrow event selection or change settings.

19. What is the JFR checkpoint mechanism and why does it matter for recordings?

A JFR checkpoint writes metadata needed to interpret events in the recording. The file format uses checkpoints so readers can reconstruct event context as they process the file. For version-specific recording internals, consult the JDK documentation instead of assuming an undocumented tuning option controls checkpoint timing.

20. How should I compare overhead across JFR event settings?

There is no JDK-independent ranking of event overhead. Cost depends on event frequency, thresholds, stack-trace settings, workload, and recording duration. Start with the documented default.jfc settings for continuous recording, use profile.jfc for a short targeted capture, and compare both against a baseline if you need to quantify impact.

Further Reading

Conclusion

Java Flight Recorder can provide useful production diagnostics, but its cost and data volume depend on the JDK, event settings, workload, duration, and storage. Start with default.jfc for continuous recording, configure maxage and/or maxsize for the disk repository, and measure the chosen setup under representative load. For a focused investigation, use profile.jfc briefly and compare the observed impact with a baseline. Analyze the resulting file with a compatible jfr CLI or JMC installation, and handle the recording as sensitive data.

Category

Related Posts

JMX and MXBeans: JVM Hotspot Diagnostics and Custom MBeans

Learn how to use JMX and MXBeans to monitor JVM memory pools, perform hotspot diagnostics, and build custom MBeans for production observability.

#jvm #jmx #mxbeans

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

JVM Stack Walking API: Fast Stack Traversal and Security Context

A guide to the JVM Stack Walking API showing how to efficiently traverse stack frames, access local variables, and extract security context without the overhead of traditional stack trace capture.

#java #jvm #stack-walking