I have the same configuration and I recently change  my cassandra-sh.yaml to :


I guess it depends on how much you use the cache (which is now in the off-heap memory).

I don't use row cache and use the default key cache size.

I have no more memory pressure nor OOM.

I think that if your off-heap memory is unused, it's better enlarging the heap (with a max limit of 8GB) 

Hope this will help.


2012/8/21 Tamar Fraenkel <tamar@tok-media.com>
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

So, for
This will result in
max(min(3734,1024), min(1867,8000)) = max(1024,1867)=1867MB or in other words 1/4 of RAM.

In http://www.datastax.com/docs/1.0/operations/tuning 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?


Tamar Fraenkel 
Senior Software Engineer, TOK Media