#17634·netty

io_uring: recycle the buffers of a provided buffer ring instead of re-allocating them

Author: franz1981Created Sep 26, 2026Updated Sep 26, 2026

IoUringFixedBufferRingAllocator and IoUringAdaptiveBufferRingAllocator both end up in AbstractIoUringBufferRingAllocator.allocate() = allocator.directBuffer(nextBufferSize()): every buffer the kernel consumed is replaced by a new ByteBuf out of a general purpose ByteBufAllocator, although the ring keeps bufferRingSize buffers alive anyway - only the object and its memory are re-created. Other io_uring users provide one contiguous region per ring and recycle the buffers by id:

Measured over the ring allocator alone (JMH, 32 buffers parked, 8 forks, Ryzen 9 7950X): 16.9 ns / 312 instructions per buffer against 31.8 ns / 627 for the fixed and 91.8 ns / 1756 for the adaptive allocator. PR follows.