|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.db.MemtableAllocator
public class MemtableAllocator
A memstore-local allocation buffer.
The MemtableAllocator is a bump-the-pointer allocator that allocates large (2MB) regions and then doles it out to threads that request slices into the array. The purpose of this class is to combat heap fragmentation in the memtable: by ensuring that all name and value column data in a given memtable refer only to large regions of contiguous memory, we ensure that large blocks get freed up when the memtable is flushed. Otherwise, the byte array allocated during insertion end up interleaved throughout the heap, and the old generation gets progressively more fragmented until a stop-the-world compacting collection occurs. TODO: we should probably benchmark whether word-aligning the allocations would provide a performance improvement - probably would speed up the Bytes.toLong/Bytes.toInt calls in KeyValue, but some of those are cached anyway
Constructor Summary | |
---|---|
MemtableAllocator()
|
Method Summary | |
---|---|
java.nio.ByteBuffer |
clone(java.nio.ByteBuffer buffer)
Allocate a slice of the given length. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemtableAllocator()
Method Detail |
---|
public java.nio.ByteBuffer clone(java.nio.ByteBuffer buffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |