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 ChunkCreator.ChunkType |
chunkType |
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,
ChunkCreator.ChunkType chunkType,
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) 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 n
|
private final int chunkSize
private final ChunkCreator.ChunkType chunkType
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, ChunkCreator.ChunkType chunkType, int maxCount, int initialCount, float poolSizePercentage)
Chunk getChunk()
putbackChunks(Chunk)
int getChunkSize()
private void putbackChunks(Chunk 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.