JVM GC tuning can be pretty complex, but the simplest solution to OOM is probably switching to G1GC and feeding it a rather large heap. Theoretically a smaller heap and carefully-tuned CMS collector is more efficient, but CMS is kind of fragile and tuning it is more of a black art, where you can generally get into a state of "good enough" with G1 and a bigger heap as long as there's physically enough RAM.
If you're on 2.x I'd strongly advise updating to 3 (probably 3.11.x), as there were some pretty significant improvement in memory allocation. 3.11 also lets you move some things off-heap. On Thu, May 10, 2018, 10:23 PM Jeff Jirsa <jji...@gmail.com> wrote: > There's no single right answer. It depends a lot on the read/write > patterns and other settings (onheap memtable, offheap memtable, etc). > > One thing that's probably always true, if you're using ParNew/CMS, 16G > heap is a bit large, but may be appropriate for some read heavy workloads, > but you'd want to make sure you start CMS earlier than default (set CMS > initiating occupancy lower than default). May find it easier to do > something like 12/3 or 12/4, and leave the remaining RAM for page cache. > > CASSANDRA-8150 has a bunch of notes for tuning GC configs ( > https://issues.apache.org/jira/browse/CASSANDRA-8150 ), and Amy's 2.1 > tuning guide is pretty solid too ( > https://tobert.github.io/pages/als-cassandra-21-tuning-guide.html ) > > > > > > On Fri, May 11, 2018 at 10:30 AM, Mokkapati, Bhargav (Nokia - IN/Chennai) > <bhargav.mokkap...@nokia.com> wrote: > >> Hi Team, >> >> >> >> I have 64GB of total system memory. 5 node cluster. >> >> >> >> xxxxxxxxxxxxx ~# free -m >> >> total used free shared buff/cache >> available >> >> Mem: 64266 17549 41592 66 5124 >> 46151 >> >> Swap: 0 0 0 >> >> xxxxxxxxxxxxx ~# >> >> >> >> and “egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo” giving 12 cpu >> cores. >> >> >> >> Currently Cassandra-env.sh calculating MAX_HEAP_SIZE as ‘8GB’ and >> HEAP_NEWSIZE as ‘1200 MB’ >> >> >> >> I am facing Java insufficient memory issue and Cassandra service is >> getting down. >> >> >> >> I going to hard code the HEAP values in Cassandra-env.sh as below. >> >> >> >> MAX_HEAP_SIZE="16G" (1/4 of total RAM) >> >> HEAP_NEWSIZE="4G" (1/4 of MAX_HEAP_SIZE) >> >> >> >> Is these values correct for my setup in production? Is there any >> disadvantages doing this? >> >> >> >> Please let me know if any of you people faced the same issue. >> >> >> >> Thanks in advance! >> >> >> >> Best regards, >> >> Bhargav M >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >