Database Reference
In-Depth Information
Garbage Collection
Many issues that stem from JVM performance can usually be traced back to
garbage collection. Periodic garbage collections usually are not a problem as most
applications expect them and are fairly tolerant of them. Adjusting a few GC-re-
lated settings should help to minimize the JVM pauses that can be a result of rap-
id allocation and deallocation of memory inside the JVM. The following options
should be set in the cassandra-env.sh as well:
-XX: + UserParNewGC. ParNew is a “stop the world while I collect the
garbage” system. This may seem like a bad idea, but this GC usually runs
quickly and is responsible only for cleaning up the “younger” generation.
-XX: + UseConcMarkSweepGC. This setting tells the JVM to allow
the concurrent collector to run with the parallel young generation collector
(also known as ParNewGC in this case).
-XX: + CMSParallelRemarkEnabled. CMS here stands for Con-
currentMarkSweep (referenced above). This setting tells the JVM
that when the CMS GC is running, the garbage collector can use multiple
threads. This usually decreases the length of a pause during the phase.
-XX: CMSInitiatingOccupancyFraction=75. If this value is
not set at runtime, the JVM will attempt to determine a good value. This is
a percentage and refers to the percent occupancy of the tenured generation
at which a CMS GC is triggered.
-XX: + UseCMSInitiatingOccupancyOnly. This value just tells
the JVM not to try to calculate its own value for CMSInitiatingOc-
cupancyFraction and to use the one provided to it.
While these settings are good generally applicable settings for Cassandra, they
are mostly for systems with smaller amounts of memory, roughly 20GB or less.
With anything larger, you will start to see diminishing returns on changes you
make. Java will be forced to take a much larger part in memory management and
garbage collection. This will invariably take up more CPU time and cause longer
pauses. A common solution is to run multiple instances of Cassandra on the same
node, ensuring that the token ranges don't coincide with the same replica.
Search WWH ::




Custom Search