Package org.apache.flink.runtime.io.disk
Class BatchShuffleReadBufferPool
java.lang.Object
org.apache.flink.runtime.io.disk.BatchShuffleReadBufferPool
A fixed-size
MemorySegment pool used by batch shuffle for shuffle data read (currently
only used by sort-merge blocking shuffle).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMemory size in bytes can be allocated from this buffer pool for a single request (4M is for better sequential read). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys this buffer pool and after which, no buffer can be allocated any more.intintintlongintintintvoidInitializes this buffer pool which allocates all the buffers.booleanvoidrecycle(Collection<org.apache.flink.core.memory.MemorySegment> segments) Recycles a collection of buffers to this buffer pool.voidrecycle(org.apache.flink.core.memory.MemorySegment segment) Recycles the target buffer to this buffer pool.voidregisterRequester(Object requester) List<org.apache.flink.core.memory.MemorySegment>Requests a collection of buffers (determined bynumBuffersPerRequest) from this buffer pool.voidunregisterRequester(Object requester)
-
Field Details
-
NUM_BYTES_PER_REQUEST
public static final int NUM_BYTES_PER_REQUESTMemory size in bytes can be allocated from this buffer pool for a single request (4M is for better sequential read).- See Also:
-
-
Constructor Details
-
BatchShuffleReadBufferPool
public BatchShuffleReadBufferPool(long totalBytes, int bufferSize)
-
-
Method Details
-
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
-
unregisterRequester
-
getAverageBuffersPerRequester
public int getAverageBuffersPerRequester() -
requestBuffers
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
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()
-