Monitor Memory usage and Garbage Collection in Bamboo
These are some recommended settings to enable Garbage Collection logging and Heap Dump when Bamboo runs on Out Of Memory.
Parameters
Please add the following parameters to Bamboo. Make sure to select the correct Java version.
Java 8:
-Xloggc:<bamboo-home>/logs/atlassian-bamboo-gc-%t.log -XX:-OmitStackTraceInFastThrow -XX:+PrintConcurrentLocks -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<bamboo-home>/logs/atlassian-bamboo-heapdump-%t.hprof -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M -verbose:gc
Java 11 and 17:
-Xlog:gc*,gc+age=trace:file=<bamboo-home>/logs/atlassian-bamboo-gc-%t.log:time,level,tags:filesize=10M,filecount=5 -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=<bamboo-home>/logs/atlassian-bamboo-heapdump-%t.hprof
Note: Remember to substitute <bamboo-home>
with a correct Bamboo Home path on your server.
GC log file location
The garbage collection traces and the heap dumps are in <bamboo-install>/logs/atlassian-bamboo-gc-%t.log
. Where %t
, is the time the file was created.
Additional Note
The -XX:+PrintGCTimeStamps
flag, prints when GCs happen relative to the start of the application. That's applicable to Java 8. On Java 11, the timestamps are implicit by -Xlog:gc*
Some helpful links:
http://blogs.atlassian.com/developer/2007/10/plugging_leaks_in_confluence.html
http://www.oracle.com/technetwork/articles/javase/gcportal-136937.html