SapMachine, a downstream distribution of OpenJDK, has introduced a new monitoring tool, SapMachine Vitals, which supports a condensed history of operating system and JVM statistics. The monitoring feature is enabled by default and can be used to retrieve information such as heap usage, metaspace size, container statistics and memory limits, number of classes loaded, and number of threads spawned.

Vitals is a combination of operating system sysstat tools and Java Virtual Machine (JVM) statistics. Data is retrieved every ten seconds by default and stored in a buffer for ten days in the JVM. The buffer contains more detailed information for the last hour. While the overhead of Vitals is relatively low with about 300 Kb of memory usage and little CPU consumption, it is still possible to disable the feature with the -XX:-EnableVitals command, Infoq wrote on the subject.

The jcmd <pid> VM.vitals command can be used to create the report for a running application. The report is also part of the hs_err_pid.log that the JVM generates as part of an abnormal exit. Finally, when the JVM is started with the -XX:+PrintVitalsAtExit argument, the Vitals report is printed to stdout before the exit is complete. Alternatively, the -XX:+DumpVitalsAtExit argument can be used to create the following files: sapmachine_vitals_pid.txt and sapmachine_vitals_pid.csv. The file names can be customized with the -XX:VitalsFile=<custom-filename> argument.

The Vitals report has three subsections: system, including container statistics, process statistics, and JVM statistics. Each subsection contains a list of metrics and their abbreviations, and at the end of the report, each metric is listed in a column and the measurements are shown in rows. To improve readability, in this article we merge the metrics and measurements by subsection from the jcmd 11818 VM.vitals command.

The vitals function is only available as part of OpenJDK’s SapMachine builds. Thomas Schuffe, JVM engineer at SAP, points out that the function is not accepted upstream because its functions overlap with Java Flight Recorder. More information can be found on GitHub and on the SapMachine Vitals blog.

Tags: , , , , , , , , , , , ,
Editor @ DevStyleR