Home > Back-end >  how to use Java 8 option -XX: UsePerfData
how to use Java 8 option -XX: UsePerfData

Time:05-20

The java 8 oracle documentation mention the option -XX: UsePerfData (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html) with the following description:

-XX: UsePerfData
    Enables the perfdata feature. This option is enabled by default to allow JVM monitoring and performance testing. Disabling it suppresses the creation of the hsperfdata_userid directories. To disable the perfdata feature, specify -XX:-UsePerfData.

But I don't how to use theses perfdata. Though which software / tool can I analyse theses data?

CodePudding user response:

-XX: UsePerfData is responsible for collecting HotSpot Performance Counters and exporting them to external tools. This option is ON by default.

With PerfData enabled, HotSpot JVM creates a file under /tmp/hsperfdata_<user> directory for each JVM process. Many tools, including jps, JConsole and VisualVM, scan this directory to find running JVMs. If you disable PerfData, the JVM will not be discovered by these tools automatically.

jstat is one of the standard JDK tools relying on HotSpot Performance Counters. jstat will not work with JVMs that have PerfData disabled.

jcmd <pid> PerfCounter.print is another standard command that prints all Performance Counters exported by the given process.

  • Related