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:

# Set the path and filename of the GC log.
# Include the PID (%p) or date (%t) in the filename
# to prevent the GC log from being overwritten
# on restarting the DataSource.
#
# jvm-options -Xloggc:var/gc-%t.log
jvm-options -Xloggc:var/gc-%p.log

# GC logging options
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 (1)
jvm-options -XX:HeapDumpPath=var
1 If the DataSource’s JVM runs out of memory, dump the JVM heap before terminating the JVM. A heap dump can provide 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-%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:+PrintConcurrentLocks -XX:+PrintCommandLineFlags -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=var