IoUringAdaptiveBufferRingAllocator Class — netty Architecture
Architecture documentation for the IoUringAdaptiveBufferRingAllocator class in IoUringAdaptiveBufferRingAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ea549e35_3c5b_37b8_5629_411ca2ddf734["IoUringAdaptiveBufferRingAllocator"] 75e82f55_a487_03ed_2fd5_e4dae2f39bcc["IoUringAdaptiveBufferRingAllocator.java"] ea549e35_3c5b_37b8_5629_411ca2ddf734 -->|defined in| 75e82f55_a487_03ed_2fd5_e4dae2f39bcc 4043f973_271f_8117_541b_b6b57bcb2b79["IoUringAdaptiveBufferRingAllocator()"] ea549e35_3c5b_37b8_5629_411ca2ddf734 -->|method| 4043f973_271f_8117_541b_b6b57bcb2b79 05bd0db5_1660_c177_ae51_10886d13cd4e["nextBufferSize()"] ea549e35_3c5b_37b8_5629_411ca2ddf734 -->|method| 05bd0db5_1660_c177_ae51_10886d13cd4e 4f70a3e6_0cbb_f353_69ce_9af22cb455f4["lastBytesRead()"] ea549e35_3c5b_37b8_5629_411ca2ddf734 -->|method| 4f70a3e6_0cbb_f353_69ce_9af22cb455f4
Relationship Graph
Source Code
transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringAdaptiveBufferRingAllocator.java lines 25–90
public final class IoUringAdaptiveBufferRingAllocator extends AbstractIoUringBufferRingAllocator {
public static final int DEFAULT_MINIMUM = 1024;
public static final int DEFAULT_INITIAL = 4096;
public static final int DEFAULT_MAXIMUM = 65536;
private final AdaptiveCalculator calculator;
public IoUringAdaptiveBufferRingAllocator() {
this(ByteBufAllocator.DEFAULT);
}
/**
* Creates new instance.
*
* @param allocator the {@link ByteBufAllocator} to use.
*/
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator) {
this(allocator, DEFAULT_MINIMUM, DEFAULT_INITIAL, DEFAULT_MAXIMUM);
}
/**
* Creates new instance.
*
* @param allocator the {@link ByteBufAllocator} to use for the allocations
* @param minimum the inclusive lower bound of the expected buffer size
* @param initial the initial buffer size when no feed back was received
* @param maximum the inclusive upper bound of the expected buffer size
*/
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum) {
this(allocator, minimum, initial, maximum, false);
}
/**
* Creates new instance.
*
* @param allocator the {@link ByteBufAllocator} to use for the allocations
* @param minimum the inclusive lower bound of the expected buffer size
* @param initial the initial buffer size when no feed back was received
* @param maximum the inclusive upper bound of the expected buffer size
* @param largeAllocation {@code true} if we should do a large allocation for the whole buffer ring
* and then slice out the buffers or {@code false} if we should do one allocation
* per buffer.
*/
public IoUringAdaptiveBufferRingAllocator(
ByteBufAllocator allocator, int minimum, int initial, int maximum, boolean largeAllocation) {
super(allocator, largeAllocation);
this.calculator = new AdaptiveCalculator(minimum, initial, maximum);
}
@Override
protected int nextBufferSize() {
return calculator.nextSize();
}
@Override
public void lastBytesRead(int attempted, int actual) {
// If we read as much as we asked for we should check if we need to ramp up the size of our next guess.
// This helps adjust more quickly when large amounts of data is pending and can avoid going back to
// the selector to check for more data. Going back to the selector can add significant latency for large
// data transfers.
if (attempted == actual) {
calculator.record(actual);
}
}
}
Source
Frequently Asked Questions
What is the IoUringAdaptiveBufferRingAllocator class?
IoUringAdaptiveBufferRingAllocator is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringAdaptiveBufferRingAllocator.java.
Where is IoUringAdaptiveBufferRingAllocator defined?
IoUringAdaptiveBufferRingAllocator is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringAdaptiveBufferRingAllocator.java at line 25.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free