-
Notifications
You must be signed in to change notification settings - Fork 0
Home
JDK Flight Recorder manages data gathered from the JVM. Data is written in memory, first to thread local buffers and then promoted to a fixed-size global ring buffer. Traditionally, this data is eventually flushed to JFR files (*.jfr) on disk, which is then consumed for analysis, for example by JDK Mission Control. With JFR streaming (OpenJDK 14+), API is provided to access the data in the buffer.
JDK Flight Recorder has a number of options for configuration on start. For a list of options, see the Oracle java documentation
Users manage the system’s recordings. Individual recordings have unique configuration and can be started, stopped, and dumped to disk on demand.
Continuous recordings run until the process stops. Time-fixed recordings end after their duration has elapsed.
Events are the basic unit of JFR data. The JVM has pre-existing events and there is API for users to supply both static and dynamic custom events. Every event can be enabled or disabled when recording to minimize overhead.
JFR profiles (*.jfc) can be used to configure the events for a recording. The JDK distribution comes with two profiles: 'default' and 'profile'.
default: Low overhead configuration safe for continuous use in production environments, typically less than 1 % overhead.
profile: Low overhead configuration for profiling, typically around 2 % overhead.
To start a process with JFR active, run:
java -XX:StartFlightRecording java -XX:StartFlightRecording=<options>
Options are comma delimited key-value pairs. For a list of options, see the Oracle java documentation
Start a recording:
jcmd <pid> JFR.start <option>
Stop a recording:
jcmd <pid> JFR.stop <options>
Dump a recording:
jcmd <pid> JFR.dump <options>
Options are comma delimited key-value pairs. With command being e.g. JFR.start
or JFR.stop
for a list of options run:
jcmd <pid> help <command>
To see availability of jmcd commands, run
jmcd <pid> help
For more information, see Oracle jcmd documentation
The JDK comes with binary tool 'jfr' that is able to examine JFR files.
It’s documentation is straightforward, see the output of:
jfr
jfr help