Starting JFR on server without GUI

When issues occur with some JVM application, it can be useful to do some capturing of JVM events using built-in flight recorder. Load imposed by JFR can be controlled by profiles, and usually it’s from 5-15% for normal usage (unless everything is captured).

To start logging, run the following commands as process user:

# settings=/usr/lib/jvm/java-11-openjdk-amd64/lib/jfr/profile.jfc key can be omited
jcmd <pid> JFR.start duration=300s settings=/usr/lib/jvm/java-11-openjdk-amd64/lib/jfr/profile.jfc
sleep 100
jcmd <pid> JFR.dump name=1 
jcmd <pid> JFR.stop name=1

Dumped file can be then copied to to local machine and analyzed with Java Mission Control GUI.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *