WebSphere Liberty verbosegc from Startup Recipe
Consider enabling Java verbose garbage collection on all JVMs, including production. This will help with performance analysis, OutOfMemoryErrors, and other post-mortem troubleshooting. Benchmarks on OpenJ9 show an overhead of less than 1% and usually less than 0.5%.
Add the following to jvm.options
(or equivalent) and
restart the JVM:
- OpenJ9 JVM (IBM
Java or IBM Semeru Runtimes Java):
-Xverbosegclog:logs/verbosegc.%seq.log,20,50000
- HotSpot JVM (OpenJDK Runtime
Environment, Oracle Java, and similar):
- Java >= 9:
-Xlog:safepoint=info,gc:file=logs/verbosegc.log:time,level,tags:filecount=5,filesize=20M
- Java 8:
-Xloggc:logs/verbosegc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20M -XX:+PrintGCDateStamps -XX:+PrintGCDetails
- Java >= 9:
Review logs/verbosegc*log
and monitor for high pause
times and that the proportion of time in GC pauses is less than ~5-10%
using the GCMV
tool.