Set the heap size for Java garbage collection


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
The default JVM garbage collection (GC) for DSE 5.1 is G1.
Note: DataStax does not recommend using G1 when using Java 7. This is due to a problem with class unloading in G1. In Java 7, PermGen fills up indefinitely until a full GC is performed.

Heap size is usually between ¼ and ½ of system memory. Do not devote all memory to heap because it is also used for offheap cache and file system cache.

See Tuning Java Virtual Machine for more information on tuning the Java Virtual Machine (JVM).

Important: If you want to use Concurrent-Mark-Sweep (CMS) garbage collection, contact the DataStax Services team for configuration help. Tuning Java resources provides details on circumstances where CMS is recommended, though using CMS requires time, expertise, and repeated testing to achieve optimal results.
The easiest way to determine the optimum heap size for your environment is:
  1. Set the MAX_HEAP_SIZE in the jvm.options file to a high arbitrary value on a single node.
  2. View the heap used by that node:
    • Enable GC logging and check the logs to see trends.
    • Use List view in OpsCenter.
  3. Use the value for setting the heap size in the cluster.
Note: This method decreases performance for the test node, but generally does not significantly reduce cluster performance.

If you don't see improved performance, contact the DataStax Services team for additional help in tuning the JVM.