Search in sources :

Example 1 with HeapPool

use of org.apache.cassandra.utils.memory.HeapPool in project cassandra by apache.

the class Memtable method createMemtableAllocatorPool.

private static MemtablePool createMemtableAllocatorPool() {
    long heapLimit = DatabaseDescriptor.getMemtableHeapSpaceInMiB() << 20;
    long offHeapLimit = DatabaseDescriptor.getMemtableOffheapSpaceInMiB() << 20;
    final float cleaningThreshold = DatabaseDescriptor.getMemtableCleanupThreshold();
    final MemtableCleaner cleaner = ColumnFamilyStore::flushLargestMemtable;
    switch(DatabaseDescriptor.getMemtableAllocationType()) {
        case unslabbed_heap_buffers_logged:
            return new HeapPool.Logged(heapLimit, cleaningThreshold, cleaner);
        case unslabbed_heap_buffers:
            return new HeapPool(heapLimit, cleaningThreshold, cleaner);
        case heap_buffers:
            return new SlabPool(heapLimit, 0, cleaningThreshold, cleaner);
        case offheap_buffers:
            return new SlabPool(heapLimit, offHeapLimit, cleaningThreshold, cleaner);
        case offheap_objects:
            return new NativePool(heapLimit, offHeapLimit, cleaningThreshold, cleaner);
        default:
            throw new AssertionError();
    }
}
Also used : MemtableCleaner(org.apache.cassandra.utils.memory.MemtableCleaner) SlabPool(org.apache.cassandra.utils.memory.SlabPool) NativePool(org.apache.cassandra.utils.memory.NativePool) HeapPool(org.apache.cassandra.utils.memory.HeapPool)

Aggregations

HeapPool (org.apache.cassandra.utils.memory.HeapPool)1 MemtableCleaner (org.apache.cassandra.utils.memory.MemtableCleaner)1 NativePool (org.apache.cassandra.utils.memory.NativePool)1 SlabPool (org.apache.cassandra.utils.memory.SlabPool)1