It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Actively looking. Java Flight Recorder. How to check what's happen with your service

Hi, warm community!

Today I want to describe small built-in tool JFR (Java Flight Recorder). How to use the Java Flight Recorder and make a snapshot. 
Let's investigate our instance.
First of all, you need to restart your app (Jira, Confluence, Bitbucket or Bamboo) with next flag for enabling that feature:
-XX:+UnlockCommercialFeatures 
-XX:+FlightRecorder
Disclaimer:
JMC and JFR are not exactly free software. You cannot use them without a contract with Oracle in a commercial, production environment.

As additionally, I like to enable that option on test env.
-XX:+UnlockDiagnosticVMOption
Well, after that you can start to making a snapshot using jcmd util on the server side.
/usr/java/latest/bin/jcmd 19088 JFR.start delay=10s duration=5m filename=/tmp/recording-without-stats.jfr

Also. you can use various commands:


JFR.start
Start a recording.

JFR.check
Check the status of all recordings running for the specified process, including the recording identification number, file name, duration, and so on.

JFR.stop
Stop a recording with a specific identification number (by default, recording 1 is stopped).

JFR.dump
Dump the data collected so far by the recording with a specific identification number (by default, data from recording 1 is dumped).

Reference:

https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/run.htm

You can download dump to the local machine and open through JMC (Java mission control) from JDK package.
Hence you can see a panel like this

Then you can choose your record:
On Overview panel you will see that panel with CPU usage and Heap usage overview:


In the section code, you can easier find hot packages and hot classes.


In the section threads, you can find the biggest thread, expand call tree and review hot methods as well.
In the section I/O, on the tab Socket Overview you can easily understand what kind remote host slow, because information like this very helpful


The last thing is


I prefer to make a snapshot with objects stats, which you can enable easier:
To enable that you need to go Template manager and click and enable object statistics and save as own one. 

Upload to server and run like this:
 /usr/java/latest/bin/jcmd 19088 JFR.start settings=/tmp/with.stats.jfc delay=10s duration=2m name=Profiling filename=/tmp/recording-with-stats.jfr
 
 
Also: you can watch that deep video on how to work with that.
Using Oracle Java Flight Recorder
References
https://www.oracle.com/technetwork/java/embedded/embedded-se/documentation/java-flight-rec-on-java-se-emb-8-2158734.html
 
Hope it helps someone. 
To me, it helps to detect very strange apps on Jira.
 
Cheers,
Gonchik Tsymzhitov

0 comments

Comment

Log in or Sign up to comment
Community showcase
Published in Agile

Learn how Arizona State University is bringing agility to higher education

Hello Atlassian Community members! My name is Keri, and I work on Atlassian's Cloud Platform Product Marketing team. I wanted to bring your attention to a case study we recently did with the IT dep...

144 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you