JDK Mission Control Logo

Start Java Flight Recorder — Notes

Gopikrishnan Naranathu Sivaprasad
2 min readNov 20, 2021

This note isn’t a full-blown tutorial of JFR, rather just the steps I recently followed to run JFR on one of the applications I am working on.

JFR is designed to be much less intrusive to the running app and thereby affecting its performance considerably less.

Note: I am using Azul OpenJDK for my application.

  1. Download jcmd and other Azul OpenJDK tools from their official website.

2. Extract the tools in the above tar:

tar xf zulu8.58.0.13-ca-jdk8.0.312-linux_x64.tar.gz

3. Move the above tools to a location accessible to the user running the service. (in case it is the logged-in user, ignore this step)

JFR is a stickler about the user running the application to have access to flight recording (Reasonable). Oh and by the way, It doesn’t care if you are root!

mv zulu8.58.0.13-ca-jdk8.0.312-linux_x64 /home/<java-app-user>/

4. Change the user to <java-app-user> (in case it is the logged-in user, ignore this step)

sudo su -l java-app-user -s /bin/bash

5. Set the following environment variables(Essential for jcmd to load libraries correctly)

export JAVA_HOME=/usr/java/jre-xxx

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/:$JAVA_HOME/lib:/home/content-library/zulu8.58.0.13-ca-jdk8.0.312-linux_x64/lib

6. Run the Flight recorder for the desired duration using the command:

../zulu8.58.0.13-ca-jdk8.0.312-linux_x64/bin/jcmd com.abc.MainClassName JFR.start duration=100s filename=flight.jfr

7. Import flight.jfr into Azul/Oracle Java Mission Control software for analysis.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response