Class LocalBufferPool

  • All Implemented Interfaces:
    AvailabilityProvider, BufferPool, BufferProvider, BufferRecycler

    public class LocalBufferPool
    extends Object
    implements BufferPool
    A buffer pool used to manage a number of Buffer instances from the NetworkBufferPool.

    Buffer requests are mediated to the network buffer pool to ensure deadlock free operation of the network stack by limiting the number of buffers per local buffer pool. It also implements the default mechanism for buffer recycling, which ensures that every buffer is ultimately returned to the network buffer pool.

    The size of this pool can be dynamically changed at runtime (setNumBuffers(int). It will then lazily return the required number of buffers to the NetworkBufferPool to match its new size.

    New buffers can be requested only when numberOfRequestedMemorySegments < currentPoolSize + maxOverdraftBuffersPerGate. In other words, all buffers exceeding the currentPoolSize will be dynamically regarded as overdraft buffers.

    Availability is defined as returning a non-overdraft segment on a subsequent requestBuffer()/ requestBufferBuilder() and heaving a non-blocking requestBufferBuilderBlocking(int). In particular,

    To ensure this contract, the implementation eagerly fetches additional memory segments from NetworkBufferPool as long as it hasn't reached maxNumberOfMemorySegments or one subpartition reached the quota.