Package org.apache.flink.runtime.io.disk
Class BatchShuffleReadBufferPool
- java.lang.Object
-
- org.apache.flink.runtime.io.disk.BatchShuffleReadBufferPool
-
public class BatchShuffleReadBufferPool extends Object
A fixed-sizeMemorySegment
pool used by batch shuffle for shuffle data read (currently only used by sort-merge blocking shuffle).
-
-
Field Summary
Fields Modifier and Type Field Description static int
NUM_BYTES_PER_REQUEST
Memory size in bytes can be allocated from this buffer pool for a single request (4M is for better sequential read).
-
Constructor Summary
Constructors Constructor Description BatchShuffleReadBufferPool(long totalBytes, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys this buffer pool and after which, no buffer can be allocated any more.int
getAvailableBuffers()
int
getAverageBuffersPerRequester()
int
getBufferSize()
long
getLastBufferOperationTimestamp()
int
getMaxConcurrentRequests()
int
getNumBuffersPerRequest()
int
getNumTotalBuffers()
void
initialize()
Initializes this buffer pool which allocates all the buffers.boolean
isDestroyed()
void
recycle(Collection<org.apache.flink.core.memory.MemorySegment> segments)
Recycles a collection of buffers to this buffer pool.void
recycle(org.apache.flink.core.memory.MemorySegment segment)
Recycles the target buffer to this buffer pool.void
registerRequester(Object requester)
List<org.apache.flink.core.memory.MemorySegment>
requestBuffers()
Requests a collection of buffers (determined bynumBuffersPerRequest
) from this buffer pool.void
unregisterRequester(Object requester)
-
-
-
Field Detail
-
NUM_BYTES_PER_REQUEST
public static final int NUM_BYTES_PER_REQUEST
Memory size in bytes can be allocated from this buffer pool for a single request (4M is for better sequential read).- See Also:
- Constant Field Values
-
-
Method Detail
-
getNumTotalBuffers
@VisibleForTesting public int getNumTotalBuffers()
-
getAvailableBuffers
@VisibleForTesting public int getAvailableBuffers()
-
getNumBuffersPerRequest
public int getNumBuffersPerRequest()
-
getMaxConcurrentRequests
public int getMaxConcurrentRequests()
-
getBufferSize
public int getBufferSize()
-
initialize
public void initialize()
Initializes this buffer pool which allocates all the buffers.
-
registerRequester
public void registerRequester(Object requester)
-
unregisterRequester
public void unregisterRequester(Object requester)
-
getAverageBuffersPerRequester
public int getAverageBuffersPerRequester()
-
requestBuffers
public List<org.apache.flink.core.memory.MemorySegment> requestBuffers() throws Exception
Requests a collection of buffers (determined bynumBuffersPerRequest
) from this buffer pool.- Throws:
Exception
-
recycle
public void recycle(org.apache.flink.core.memory.MemorySegment segment)
Recycles the target buffer to this buffer pool. This method should never throw any exception.
-
recycle
public void recycle(Collection<org.apache.flink.core.memory.MemorySegment> segments)
Recycles a collection of buffers to this buffer pool. This method should never throw any exception.
-
getLastBufferOperationTimestamp
public long getLastBufferOperationTimestamp()
-
destroy
public void destroy()
Destroys this buffer pool and after which, no buffer can be allocated any more.
-
isDestroyed
public boolean isDestroyed()
-
-