Enabling GC logging for a DataSource’s JVM

Caplin Support recommend enabling garbage collection (GC) logging for production Java virtual machines (JVMs). Garbage collection logs provide valuable information for tuning a JVM’s heap size and investigating performance and memory problems.

Enabling GC logging for a C DataSource

C DataSources include Liberator, Transformer, and the TREP Adapter.

To enable GC logging for a C DataSource’s embedded JVM, add the following jvm-options configuration items to the DataSource’s java.conf file:

jvm-options -Xloggc:var/gc.log (1)
jvm-options -XX:+PrintGCDetails
jvm-options -XX:+PrintGCDateStamps
jvm-options -XX:+UseGCLogFileRotation
jvm-options -XX:NumberOfGCLogFiles=10
jvm-options -XX:GCLogFileSize=5M
jvm-options -XX:+PrintConcurrentLocks
jvm-options -XX:+PrintCommandLineFlags
jvm-options -XX:+HeapDumpOnOutOfMemoryError (2)
jvm-options -XX:HeapDumpPath=var
1 Write GC logs to the DataSource’s var directory
2 If the DataSource’s JVM runs out of memory, dump the JVM heap before terminating the JVM. The heap dump provides valuable information to Caplin Support

Enabling GC logging for a Java DataSource

To enable GC logging for a Java DataSource, add the following command-line arguments to the java command in the DataSource’s DataSource/bin/start-jar.sh script:

-Xloggc:var/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:+PrintConcurrentLocks -XX:+PrintCommandLineFlags -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=var