teriksson avatar image
teriksson asked Erick Ramirez answered

Best (JVM) Memory settings for Apache Cassandra, articles ?

Could someone guide to what the best JVM Memory settings would be for Apache Cassandra ?

I have read a couple of postings here, but did not find any guideline.

The more memory I have I can utilise the bloom filters, key and row cache better, that is pretty much it. But how can I know if I need 12 gig, 24 Gig, 32 Gig, 64 Gig, 128.... of heap. Is there some sort of metric I can look at to see when it is time to increase memory or even shrink.

I need to be carful, and ensure that I use G1 when moving above 12 Gig and not move beyond 64 Gig due to Linux page cache.

Today one of the systems I investigate has 64 Gig, which strikes me as way too much

But I need to motivate that, so how would I be able to tell what is a good number of our situation.

So if you have any good articles to share that would be great

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

In my experience, G1 GC performs best for Cassandra workloads with larger heap sizes. In this context, "large" is 20GB and above.

As a general rule, I recommend using CMS for heap sizes of 8GB, 16GB up to 24GB. For heap sizes 20GB and above, consider switching to G1 GC but this isn't an absolute rule. There are some scenarios where you might decide based on your testing to stick with CMS.

Again in my experience, I have seen only a handful (out of hundreds of clusters I've worked on) where very large heap sizes work. I recommend a maximum of 31GB with G1 GC (32GB has less addressable objects so works out less than a 31GB heap).

Have a look at Garbage Collection Tuning for Apache Cassandra from The Last Pickle for some further guidance. There's also the Recommended production settings for DataStax Enterprise but has relevance for pure Cassandra workloads. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.