Actively looking. Java Flight Recorder. How to check what's happen with your service
- Other Apps
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:
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.
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:
Start a recording.
Check the status of all recordings running for the specified process, including the recording identification number, file name, duration, and so on.
Stop a recording with a specific identification number (by default, recording 1 is stopped).
Dump the data collected so far by the recording with a specific identification number (by default, data from recording 1 is dumped).
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
Hope it helps someone.
To me, it helps to detect very strange apps on Jira.