Changing the Garbage-First MaxGCPauseMillis parameter

Set the peak pause time for the Garbage-First (G1) garbage collector in the jvm.options file.


The location of the jvm.options file depends on the type of installation:
Package installations /etc/dse/cassandra/jvm.options
Tarball installations installation_location/resources/cassandra/conf/jvm.options

A pause occurs when a region of memory is full and the JVM needs to make space to continue. A region can fill up, if the rate data is stored in memory exceeds the rate at which it is removed. When tuning the JVM, try to minimize garbage collection pause, also known as a stop-the-world event. For more details, see Garbage collection pauses.

During a pause, all operations are suspended. Because a pause affects networking, the node can appear as down to other nodes in the cluster. SELECT and INSERT statements wait, which increases read and write latencies. Avoid pauses longer than a second, or multiple pauses within a second.

MaxGCPauseMillis sets the peak pause time expected in the environment. By default, DataStax Enterprise (DSE) sets the maximum to 500 milliseconds (-XX:MaxGCPauseMillis=500). DataStax recommends staying between 500-2000 ms. Set the maximum value to the expected peak pause length (not the target pause length). When adjusting the GC pause, there is always a tradeoff between latency and throughput:
  • Longer pause increases latency and throughput
  • Shorter pause decreases latency and throughput
CAUTION: Setting MaxGCPauseMillis lower than 500 ms to force lower latency collections might not have the intended effect. When this value is set lower, it causes GC to run more aggressively and less efficiently, which can steal cycles without yielding considerable benefit.

Set the value for the -XX:MaxGCPauseMillis parameter in the jvm.options file.