Cherry
Cherry

Reputation: 33618

How reduce cassandra virtual memory usage?

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.

Upvotes: 20

Views: 21863

Answers (3)

Gyuri
Gyuri

Reputation: 4902

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.

Upvotes: 30

Jose Martinez Poblete
Jose Martinez Poblete

Reputation: 152

After some trial and error, we found disk_access_mode: mmap_index_only provides the best results. Also helps to stay out of the Linux OOM killer radar

Upvotes: 0

catpaws
catpaws

Reputation: 2283

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

Upvotes: 1

Related Questions