Package io.netty.channel.uring
Class IoUringAdaptiveBufferRingAllocator
- java.lang.Object
-
- io.netty.channel.uring.AbstractIoUringBufferRingAllocator
-
- io.netty.channel.uring.IoUringAdaptiveBufferRingAllocator
-
- All Implemented Interfaces:
IoUringBufferRingAllocator
public final class IoUringAdaptiveBufferRingAllocator extends AbstractIoUringBufferRingAllocator
IoUringBufferRingAllocator
implementation which uses an adaptive strategy to allocate buffers, which will decrease / increase the buffer size depending on if the allocated buffers were completely used or not before.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INITIAL
static int
DEFAULT_MAXIMUM
static int
DEFAULT_MINIMUM
-
Constructor Summary
Constructors Constructor Description IoUringAdaptiveBufferRingAllocator()
IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator)
Creates new instance.IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum)
Creates new instance.IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum, boolean largeAllocation)
Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
lastBytesRead(int attempted, int actual)
Does nothing by default, sub-classes might override this.protected int
nextBufferSize()
Return the next buffer size of eachByteBuf
that is put into the buffer ring.-
Methods inherited from class io.netty.channel.uring.AbstractIoUringBufferRingAllocator
allocate, allocateBatch
-
-
-
-
Field Detail
-
DEFAULT_MINIMUM
public static final int DEFAULT_MINIMUM
- See Also:
- Constant Field Values
-
DEFAULT_INITIAL
public static final int DEFAULT_INITIAL
- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM
public static final int DEFAULT_MAXIMUM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator()
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator)
Creates new instance.- Parameters:
allocator
- theByteBufAllocator
to use.
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum)
Creates new instance.- Parameters:
allocator
- theByteBufAllocator
to use for the allocationsminimum
- the inclusive lower bound of the expected buffer sizeinitial
- the initial buffer size when no feed back was receivedmaximum
- the inclusive upper bound of the expected buffer size
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum, boolean largeAllocation)
Creates new instance.- Parameters:
allocator
- theByteBufAllocator
to use for the allocationsminimum
- the inclusive lower bound of the expected buffer sizeinitial
- the initial buffer size when no feed back was receivedmaximum
- the inclusive upper bound of the expected buffer sizelargeAllocation
-true
if we should do a large allocation for the whole buffer ring and then slice out the buffers orfalse
if we should do one allocation per buffer.
-
-
Method Detail
-
nextBufferSize
protected int nextBufferSize()
Description copied from class:AbstractIoUringBufferRingAllocator
Return the next buffer size of eachByteBuf
that is put into the buffer ring.- Specified by:
nextBufferSize
in classAbstractIoUringBufferRingAllocator
- Returns:
- the next size.
-
lastBytesRead
public void lastBytesRead(int attempted, int actual)
Description copied from class:AbstractIoUringBufferRingAllocator
Does nothing by default, sub-classes might override this.- Specified by:
lastBytesRead
in interfaceIoUringBufferRingAllocator
- Overrides:
lastBytesRead
in classAbstractIoUringBufferRingAllocator
- Parameters:
attempted
- the attempted bytes to read.actual
- the number of bytes that could be read.
-
-