Class ChunkCreator.MemStoreChunkPool
java.lang.Object
org.apache.hadoop.hbase.regionserver.ChunkCreator.MemStoreChunkPool
- All Implemented Interfaces:
HeapMemoryManager.HeapMemoryTuneObserver
- Enclosing class:
- ChunkCreator
private class ChunkCreator.MemStoreChunkPool
extends Object
implements HeapMemoryManager.HeapMemoryTuneObserver
A pool of
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.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final AtomicLong
private final int
private final ChunkCreator.ChunkType
private final String
private int
private final float
private final BlockingQueue<Chunk>
private final LongAdder
private final ScheduledExecutorService
Statistics thread schedule poolprivate static final int
Statistics thread -
Constructor Summary
ConstructorDescriptionMemStoreChunkPool
(String label, int chunkSize, ChunkCreator.ChunkType chunkType, int maxCount, int initialCount, float poolSizePercentage) -
Method Summary
Modifier and TypeMethodDescription(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
private int
void
onHeapMemoryTune
(long newMemstoreSize, long newBlockCacheSize) This method would be called by HeapMemoryManger when a heap memory tune action took place.private void
Add the chunks to the pool, when the pool achieves the max size, it will skip the remaining chunks
-
Field Details
-
chunkSize
-
chunkType
-
maxCount
-
reclaimedChunks
-
poolSizePercentage
-
scheduleThreadPool
Statistics thread schedule pool -
statThreadPeriod
Statistics thread- See Also:
-
chunkCount
-
reusedChunkCount
-
label
-
-
Constructor Details
-
MemStoreChunkPool
MemStoreChunkPool(String label, int chunkSize, ChunkCreator.ChunkType chunkType, int maxCount, int initialCount, float poolSizePercentage)
-
-
Method Details
-
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. When we have already created max allowed chunks and no free chunks as of now, return null. It is the responsibility of the caller to make a chunk then. Note: Chunks returned by this pool must be put back to the pool after its use.- Returns:
- a chunk
- See Also:
-
getChunkSize
int getChunkSize() -
putbackChunks
Add the chunks to the pool, when the pool achieves the max size, it will skip the remaining chunks -
getMaxCount
-
onHeapMemoryTune
Description copied from interface:HeapMemoryManager.HeapMemoryTuneObserver
This method would be called by HeapMemoryManger when a heap memory tune action took place.- Specified by:
onHeapMemoryTune
in interfaceHeapMemoryManager.HeapMemoryTuneObserver
- Parameters:
newMemstoreSize
- The newly calculated global memstore sizenewBlockCacheSize
- The newly calculated global blockcache size
-