Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How reduce cassandra virtual memory usage?

Tags:

Is there a settings in cassandra to reduce it memory usage? I understand that cassandra manages memory well, but for testing purposes I do not want to spent 6Gb memory only when cassandra service running on my windows mchine.

UPDATED

I have tired setting disk_access_mode: standart instead of disk_access_mode: auto. It was not help. Also I pay attention that in cassandra 2.0.9 cassandra.yaml file do not contains disk_access_mode by default. So it seems (but I not sure) that disk_access_mode was removed from cassandra.

like image 366
Cherry Avatar asked Nov 13 '14 11:11

Cherry


People also ask

How much RAM does Cassandra need?

While Cassandra can be made to run on small servers for testing or development environments (including Raspberry Pis), a minimal production server requires at least 2 cores, and at least 8GB of RAM. Typical production servers have 8 or more cores and at least 32GB of RAM.

How do I check my Cassandra memory usage?

yes Cassandra provides a command line interface for management. You can use nodetool -u username -pw ********** info (if jmx is enabled ) command to get information about how much Heap and Off Heap Memory is used.

How do I increase Cassandra memory?

To increase the stack size, uncomment and modify the default setting in the cassandra-env.sh file. Also, decreasing the memtable space to make room for Solr caches can improve performance. Modify the memtable space by changing the memtable_heap_space_in_mb and memtable_offheap_space_in_mb properties in the cassandra.

How do I set the heap size in Cassandra?

As stated in the Tuning Java resources section of the documentation: If you decide to change the Java heap sizing, both MAX_HEAP_SIZE and HEAP_NEWSIZE should should be set together in conf/cassandra-env.sh.


2 Answers

As @catpaws points out the key is in the documentation at Tuning Java resources and cassandra-env.sh (on my mac I found it in /usr/local/etc/cassandra/cassandra-env.sh) but she falls short of answering the question.

So here is what I did and what happened: I looked at my Activity Monitor and noticed the java (cassandra) memory usage being ~4GB. Then I read the docs and found that the ~4GB is around the same as the allocated heap using the formula

max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB)

Then I edited cassandra-env.sh where it says "Override these to set the amount..." and set

MAX_HEAP_SIZE="2GB"

form the original 4GB. I also set

HEAP_NEWSIZE="400M"

but that is not necessary to reduce the memory usage.

I restarted cassandra and checked the Activity Monitor. It said the Memory usage java (cassandra) was now only ~2GB.

like image 127
Gyuri Avatar answered Sep 28 '22 12:09

Gyuri


The conf/cassandra-env.sh file control environment settings for Cassandra. See comments in the file and docs: http://www.datastax.com/documentation/cassandra/2.1/cassandra/operations/ops_tune_jvm_c.html

like image 44
catpaws Avatar answered Sep 28 '22 12:09

catpaws