OpenJDK 11 Flight Recorder

Overview

Java 11 was released on September 26, 2018. From this version, Flight Recorder can be used with OpenJDK, so let's see how to use it.

how to use

Advance preparation

Mission control is required to view the files recorded by Flight Recorder and must be installed separately from the JDK. You can find the installer at the following site. https://jdk.java.net/jmc/ (Early access as of October 18, 2018)

mission control sample screen スクリーンショット 2018-10-18 12.15.51.png

Profiling record

Profiling recording is a usage such as recording from XX seconds to YY seconds. Specify the following options when executing the java command.

-XX:StartFlightRecording=delay=20s,duration=60s,filename=myRecording.jfr,settings=profile,name=SampleRecording

--delay specifies how many seconds after executing the java command to start recording -duration is the number of seconds to record --Specify the file to save the record with filename (you can see the profile by reading this file with mission control)

Continuous recording

You can record continuously and save the latest X-minute profile or full-term profile to a file as needed. Specify the following options when executing the java command.

-XX:+FlightRecorder -XX:StartFlightRecording=maxage=5m,settings=default,disk=true

--maxage is the maximum retention period

Record running applications

You may want to apply the flight recorder to an application that is already running. In that case, you can start recording by selecting Start Flight Recording from the mission control screen. Both profiling recording and continuous recording can be selected.

スクリーンショット 2018-10-18 12.19.26.png

mission control When you load the jfr file saved on the disk, the following profile screen will be displayed. スクリーンショット 2018-10-18 12.26.10.png

On the Threads screen, you can see the same information as the information that can be obtained by thread dump. スクリーンショット 2018-10-18 12.32.08.png

On the memory screen, you can see the same information as the information that can be obtained by heap dump. スクリーンショット 2018-10-18 12.33.48.png

In method profiling, you can see which method is called most often. It's useful for performance analysis. スクリーンショット 2018-10-18 12.36.24.png

Garbage collection shows the same information as GC logs. スクリーンショット 2018-10-18 12.37.43.png

Recommended Posts

OpenJDK 11 Flight Recorder
Troubleshooting with Java Flight Recorder
I checked Java Flight Recorder (JFR)
AppCDS @ OpenJDK
OpenJDK installation
Check heap usage with Java Flight Recorder