DEV Community

Cover image for Collecting Java Flight Recording (JFR) on openjdk
Swapnil B. Bhisey
Swapnil B. Bhisey

Posted on

2 2

Collecting Java Flight Recording (JFR) on openjdk

From OpenJDK 8u262 has JFR support as its backported with - JDK-8223147: JFR Backport.

Following is just in case if you want to use JFR on openjdk (possible through azul). We just azul opnjdk and it works on my lab instance for collecting JFR. In case in future if anyone wants to use all steps.

With openjdk JFR compress=true don’t work but settings=profile does work.

Java Mission Control from oracle was not able to read the file but you can use zulu zmc .

To download azul OSS jdk

https://www.azul.com/downloads/zulu-community/?architecture=x86-64-bit&package=jdk

As my default JMC did not work with .jfr generated by zing jdk I used following.

https://www.azul.com/products/zulu-mission-control/

  • Unlock commercial features.
sudo -u <user> jcmd <pid>  VM.unlock_commercial_features
Enter fullscreen mode Exit fullscreen mode
  • Start JFR collection with settings=profile
sudo -u <user> jcmd <PID> JFR.start name=<jfr_name> settings=profile
Enter fullscreen mode Exit fullscreen mode
  • Dump JFR
sudo -u <user> jcmd <PID> JFR.dump name=<jfr_name> filename=/tmp/`hostname -i`.jfr
Enter fullscreen mode Exit fullscreen mode
  • Make sure JFR file is generated.
ls -lrt /tmp/`hostname -i`.jfr
Enter fullscreen mode Exit fullscreen mode
  • Stop JFR process
sudo -u <user> /usr/lib/jvm/java-1.8.0-openjdk/bin/jcmd  <PID> JFR.stop name=<jfr_name>
Enter fullscreen mode Exit fullscreen mode
  • Check if any additional JFR process are runing and stop if its not in use
sudo -u <user> jcmd <PID> JFR.check
Enter fullscreen mode Exit fullscreen mode

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more