Back to Zing Documentation Home
Using Java Flight Recorder
The Java Flight Recorder (JFR) feature allows you to record JVM, system, and Java level events to monitor the behavior and troubleshoot problems in your Java applications. Keeping the overhead of the recording process low, Zing Java Flight Recorder records large amount of information about your system from command-line parameters and system properties to time spent executing a piece of code.
JFR is available in Zing without the need for command-line options to enable it.
To analyze the JVM or your application, you can either interactively connect to a Java process from the ZMC desktop application or start a JFR recording on the command line with the
JFR Recording with
On the same host and userid as the java process under analysis, run the following command to start a recording:
jcmd JVMID JFR.start filename=rec.jfr
JVMID is either the process ID or the classname assigned with the java process as shown when running
jcmd without parameters.
To stop a recording, use:
jcmd JVMID JFR.stop name=1
To start a recording with more detailed metrics, use the following instead:
jcmd JVMID JFR.start filename=rec.jfr settings=profile
Analyzing a JFR Recording
Alternatively, a Java Flight recording can be viewed using the
jfr command-line tool.
Example usage of the
$JAVA_HOME/bin/jfr print rec.jfr > file.txt
Using the ZMC Desktop Application
With the ZMC application, you can also start and stop recording or interactively browse metrics of the java process under analysis.
By default, JFR uses a Unix socket for communication and therefore does not offer remote connections. To allow remote connection, you need to enable the JVM's JMX connector.
See Find JVM to connect to in the
Starting a Recording at JVM Start Time
For detailed performance analysis, you might prefer to start a JFR recording directly when launching a java process.
To enable recording, add either of the following command-line options to the java process under analysis:
-XX:StartFlightRecording=filename=rec.jfr- for an on-disk recording
-XX:StartFlightRecording=disk=false,filename=rec.jfr- for an in-memory recording
More Java Flight Recorder command-line options are listed in Using ZVM Command-Line Options.
© Azul Systems, Inc. 2020 All rights reserved.