If you run Java application benchmarks, it's also useful to save PerfData memory to hsperfdata_
- -XX:+PerfDataSaveToFile
How to Read hsperfdata File?
To display statistics collected in PerfData memory, you can use:
- jstat[3]
- Experimental JVM Statistics Monitoring Tool - It can attach to an instrumented HotSpot Java virtual machine and collects and logs performance statistics as specified by the command line options. (formerly jvmstat)
- Online
- You can attach to an instrumented HotSpot JVM and collect and log performance statistics at runtime.
- Offline
- You can set -XX:+PerfDataSaveToFile flag and read the contents of the hsperfdata_
file on the exit of JVM.
Loaded Bytes Unloaded Bytes Time
30600 64816.3 2 3.2 19.74
You can check all available command options supported by jstat using:
$jdk-hs/bin/jstat -options
-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation
HotSpot Just-In-Time Compiler Statistics
One of the command option supported by jstat is "-compiler", which can provide high-level JIT compiler statistics.
| Column | Description |
|---|---|
| Compiled | Number of compilation tasks performed. |
| Failed | Number of compilation tasks that failed. |
| Invalid | Number of compilation tasks that were invalidated. |
| Time | Time spent performing compilation tasks. |
| FailedType | Compile type of the last failed compilation. |
| FailedMethod | Class name and method for the last failed compilation. |
In the following, we have shown the compiler statistics of three managed servers in one WLS Domain using two different JVM builds:
$/scratch/perfgrp/JVMs/jdk-hs/bin/jstat -compiler file:///<Path to Domain>/MyDomain/hsperfdata_9872
JVM1
Compiled Failed Invalid Time FailedType FailedMethod
33210 13 0 232.97 1 oracle/ias/cache/Bucket objInvalidate
74054 20 0 973.03 1 oracle/security/o5logon/b b
74600 18 0 1094.21 1 oracle/security/o5logon/b b
JVM2
Compiled Failed Invalid Time FailedType FailedMethod
33287 10 0 246.26 1 oracle/ias/cache/Bucket objInvalidate
68237 18 0 1022.46 1 oracle/security/o5logon/b b
67346 18 0 943.79 1 oracle/security/o5logon/b b
Given the above statistics, we could take next action on analyzing why JVM2 generating less compiled methonds than JVM1 did. At least this is one of the use case for using PerfData with its associated tool—jstat.
PerfData-Related JVM Options
Note that the default size of PerfData memory is 32K. Therefore the file (i.e., hsperfdata_ file) dumped on exit is also 32K in size.