@InterfaceAudience.Private public class MemStoreChunkPool extends Object
HeapMemStoreLAB.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.
The pool instance is globally unique and could be obtained through
getPool(Configuration)
getChunk()
is called when MemStoreLAB allocating
bytes, and putbackChunks(BlockingQueue)
is called
when MemStore clearing snapshot for flushModifier and Type | Class and Description |
---|---|
private static class |
MemStoreChunkPool.StatisticsThread |
Modifier and Type | Field and Description |
---|---|
(package private) static String |
CHUNK_POOL_INITIALSIZE_KEY |
(package private) static String |
CHUNK_POOL_MAXSIZE_KEY |
(package private) static boolean |
chunkPoolDisabled
Boolean whether we have disabled the memstore chunk pool entirely.
|
private int |
chunkSize |
private AtomicLong |
createdChunkCount |
private static MemStoreChunkPool |
GLOBAL_INSTANCE |
private static org.apache.commons.logging.Log |
LOG |
private int |
maxCount |
(package private) static float |
POOL_INITIAL_SIZE_DEFAULT |
(package private) static float |
POOL_MAX_SIZE_DEFAULT |
private BlockingQueue<HeapMemStoreLAB.Chunk> |
reclaimedChunks |
private AtomicLong |
reusedChunkCount |
private ScheduledExecutorService |
scheduleThreadPool
Statistics thread schedule pool
|
private static int |
statThreadPeriod
Statistics thread
|
Constructor and Description |
---|
MemStoreChunkPool(org.apache.hadoop.conf.Configuration conf,
int chunkSize,
int maxCount,
int initialCount) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clearChunks() |
(package private) static void |
clearDisableFlag() |
(package private) HeapMemStoreLAB.Chunk |
getChunk()
Poll a chunk from the pool, reset it if not null, else create a new chunk
to return
|
(package private) int |
getMaxCount() |
(package private) static MemStoreChunkPool |
getPool(org.apache.hadoop.conf.Configuration conf) |
(package private) int |
getPoolSize() |
private void |
logStats() |
(package private) void |
putbackChunk(HeapMemStoreLAB.Chunk chunk)
Add the chunk to the pool, if the pool has achieved the max size, it will
skip it
|
(package private) void |
putbackChunks(BlockingQueue<HeapMemStoreLAB.Chunk> chunks)
Add the chunks to the pool, when the pool achieves the max size, it will
skip the remaining chunks
|
private static final org.apache.commons.logging.Log LOG
static final String CHUNK_POOL_MAXSIZE_KEY
static final String CHUNK_POOL_INITIALSIZE_KEY
static final float POOL_MAX_SIZE_DEFAULT
static final float POOL_INITIAL_SIZE_DEFAULT
private static MemStoreChunkPool GLOBAL_INSTANCE
static boolean chunkPoolDisabled
private final int maxCount
private final BlockingQueue<HeapMemStoreLAB.Chunk> reclaimedChunks
private final int chunkSize
private final ScheduledExecutorService scheduleThreadPool
private static final int statThreadPeriod
private AtomicLong createdChunkCount
private AtomicLong reusedChunkCount
MemStoreChunkPool(org.apache.hadoop.conf.Configuration conf, int chunkSize, int maxCount, int initialCount)
HeapMemStoreLAB.Chunk getChunk()
void putbackChunks(BlockingQueue<HeapMemStoreLAB.Chunk> chunks)
chunks
- void putbackChunk(HeapMemStoreLAB.Chunk chunk)
chunk
- int getPoolSize()
void clearChunks()
private void logStats()
static MemStoreChunkPool getPool(org.apache.hadoop.conf.Configuration conf)
conf
- int getMaxCount()
static void clearDisableFlag()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.