private class ChunkCreator.MemStoreChunkPool extends Object implements HeapMemoryManager.HeapMemoryTuneObserver
Chunk
instances.
MemStoreChunkPool caches a number of retired chunks for reusing, it could
decrease allocating bytes when writing, thereby optimizing the garbage
collection on JVM.Modifier and Type | Class and Description |
---|---|
private class |
ChunkCreator.MemStoreChunkPool.StatisticsThread |
Modifier and Type | Field and Description |
---|---|
private AtomicLong |
chunkCount |
private int |
chunkSize |
private String |
label |
private int |
maxCount |
private float |
poolSizePercentage |
private BlockingQueue<Chunk> |
reclaimedChunks |
private LongAdder |
reusedChunkCount |
private ScheduledExecutorService |
scheduleThreadPool
Statistics thread schedule pool
|
private static int |
statThreadPeriod
Statistics thread
|
Constructor and Description |
---|
MemStoreChunkPool(String label,
int chunkSize,
int maxCount,
int initialCount,
float poolSizePercentage) |
Modifier and Type | Method and Description |
---|---|
(package private) Chunk |
getChunk()
Poll a chunk from the pool, reset it if not null, else create a new chunk to return if we have
not yet created max allowed chunks count.
|
(package private) Chunk |
getChunk(CompactingMemStore.IndexType chunkIndexType) |
(package private) int |
getChunkSize() |
private int |
getMaxCount() |
void |
onHeapMemoryTune(long newMemstoreSize,
long newBlockCacheSize)
This method would be called by HeapMemoryManger when a heap memory tune action took place.
|
private void |
putbackChunks(Chunk c)
Add the chunks to the pool, when the pool achieves the max size, it will skip the remaining
chunks
|
private final int chunkSize
private int maxCount
private final BlockingQueue<Chunk> reclaimedChunks
private final float poolSizePercentage
private final ScheduledExecutorService scheduleThreadPool
private static final int statThreadPeriod
private final AtomicLong chunkCount
private final LongAdder reusedChunkCount
MemStoreChunkPool(String label, int chunkSize, int maxCount, int initialCount, float poolSizePercentage)
Chunk getChunk()
putbackChunks(Chunk)
Chunk getChunk(CompactingMemStore.IndexType chunkIndexType)
int getChunkSize()
private void putbackChunks(Chunk c)
c
- private int getMaxCount()
public void onHeapMemoryTune(long newMemstoreSize, long newBlockCacheSize)
HeapMemoryManager.HeapMemoryTuneObserver
onHeapMemoryTune
in interface HeapMemoryManager.HeapMemoryTuneObserver
newMemstoreSize
- The newly calculated global memstore sizenewBlockCacheSize
- The newly calculated global blockcache sizeCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.