I have a question regarding Cassandra heap size.
Cassandra calculates heap size in cassandra-env.sh according to the following algorythm
# set max heap size based on the following
# max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
# calculate 1/2 ram and cap to 1024MB
# calculate 1/4 ram and cap to 8192MB
# pick the max
This will result in
max(min(3734,1024), min(1867,8000)) = max(1024,1867)=1867MB
or in other words 1/4 of RAM.
it says: "Cassandra's default configuration opens the JVM with a heap size of 1/4 of the available system memory (or a minimum 1GB and maximum of 8GB for systems with a very low or very high amount of RAM). Heapspace should be a minimum of 1/2 of your RAM, but a maximum of 8GB. The vast majority of deployments do not benefit from larger heap sizes because (in most cases) the ability of Java 6 to gracefully handle garbage collection above 8GB quickly diminishes."
If I understand this correctly, this means it is better if my heap size will be 1/2 of RAM, 3734MB.
I am running on EC2 m1.large instance (
7.5 GB memory, 4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)).
My system seems to be suffering from lack of memory, and I should probably increase heap or (and?) reduce key cache size.
Would you recommend changing the heap to half RAM?
If yes, should I hard-code it in acassandra-env.sh?
Senior Software Engineer, TOK Media