Vishal Sharma
Vishal Sharma

Reputation: 1750

Memtable type and size allocation

In Cassandra 3.11.2, there are 3 choices for the type of Memtable allocation and as per my understanding, if I want to keep Memtables on JVM heap I can use heap_buffers and if I want to store Memtables outside of JVM heap then I've got 2 options offheap_buffers and offheap_objects.

What exactly is the difference between the 2 choices given for off-heap allocation?

Also, the permitted memory space to be used for Memtables can be set at 2 places in the YAML file, i.e. memtable_heap_space_in_mb and memtable_offheap_space_in_mb.

Do I need to configure some space in both heap and offheap, irrespective of the Memtable allocation type or do I need to set only one of them based on my Memtable allocation type i.e. memtable_heap_space_in_mb when using heap buffers and memtable_offheap_space_in_mb only when using either of the other 2 offheap options?

Upvotes: 3

Views: 2033

Answers (1)

Horia
Horia

Reputation: 2982

  • heap_buffers (which is the default) allocates memtables on the heap using Java NIO.

  • offheap_buffers allocates a portion of each memtable both on and off the heap using the same Java NIO.

  • offheap_objects uses native memory directly, so Cassandra will manage by itself the memtable memory (both allocation and garbage collection). This feature it's not very well documented so maybe it's better not to use it.

For both memtable_heap_space_in_mb and memtable_offheap_space_in_mb I think it's best to stick with the default values. For each, the default is 1/4 of the total heap size. But if you plan to change something, probably it's better to make really small changes, since it will reduce the amount of memory that Cassandra can use.

Upvotes: 4

Related Questions