Database Reference
In-Depth Information
Maximum Heap Size
The first thing that administrators usually toy with when tuning JVM settings is
the maximum heap size. The option for this is -Xmx$size , where $size is the
desired maximum size of the JVM heap. This value is set in your conf/cassandra-
env.sh file and is defined as MAX_HEAP_SIZE . A good place to start is figur-
ing out how much memory you have on the machine and cutting it in half. You
will definitely need to leave enough memory for the operating system to be able
to function properly. The operating system is fairly intelligent about its memory
management, so it is usually smarter to slightly underallocate to the JVM. To de-
termine the approximate size of Cassandra's internal data structures, a good rule
of thumb is memtable_throughput_in_mb * 3 * number_of_hot_CFs + 1G + in-
ternal_caches.
Another important option in tuning the JVM is to set the thread stack size,
-Xss$size . In Java, each thread has its own stack that holds function call or
method arguments, return addresses, and the like. In other words, by setting the
-Xss parameter, you are able to limit the amount of memory consumed by an in-
dividual thread. Setting this to 128KB is typically a safe bet. You should consider
raising this value only if you see OutOfMemoryError errors with the addition-
al message that Java is unable to create new native threads. Even then, most of the
time it will be indicative of another problem that should be handled first.
If you find yourself needing to set a larger heap size and you are beginning
to run short on memory (and you are using the Oracle JVM), you can look at al-
lowing the JVM to compress ordinary object pointers. An ordinary object pointer
(OOP) is a managed pointer to an object in the JVM. Normally, an object pointer
in Java is the same size as the machine pointer. When CPU architectures switched
to 64-bit, the size of the pointers in the JVM heap increased with it. By adding the
option to compress pointers, you can reduce their impact on the heap. You can do
this by adding the value -XX:+UseCompressedOops to your conf/cassandra-
env.sh file.
Search WWH ::




Custom Search