Skip to main content
SUNDAY SYSTEMS DIGEST · ONE MEASURED ESSAY EVERY WEEKREAD · BENCHMARK · REFLECTZERO TRACKING PIXELS · FULL RSS & MARKDOWN ARCHIVENEW BENCHMARK: DETERMINISTIC RAFT LEASE QUORUMS
KERN.

Search Archive

Recent & Most Read Essays (8)

Registered Buffer Rings in io_uring for High-Fanout RPC Gateways

Replacing `epoll` readiness loops with kernel-managed multishot `IORING_OP_RECV` buffer rings cut syscall overhead by 71% on 100GbE internal service meshes.

Henrik Lindqvist
Henrik Lindqvist

Principal Systems Architect · Stockholm

Jul 19, 20269 min read221 words
Registered Buffer Rings in io_uring for High-Fanout RPC Gateways

Readiness-based epoll servers suffer from an structural memory tax when handling 80,000 mostly idle keep-alive connections: if you pre-allocate a 16 KB read buffer per connection, you burn 1.28 GB of RAM doing nothing; if you wait for EPOLLIN and allocate just before calling recv(), you double your syscall rate per frame.

Kernel-Selected Buffers With PBUF_RING

Linux 5.19+ solved this cleanly via provided buffer rings (io_uring_buf_ring) paired with multishot IORING_OP_RECV. User space registers a pool of 4,096 page-aligned 8 KB buffers per worker thread. Only when packets physically arrive on a socket does the kernel pick a free buffer ID, copy payload bytes directly into it, and post a completion queue entry carrying IORING_CQE_F_BUFFER.

rust
let flags = cqe.flags();
if flags & IORING_CQE_F_BUFFER != 0 {
    let bid = (flags >> IORING_CQE_BUFFER_SHIFT) as u16;
    let slice = buf_ring.borrow_slice(bid, cqe.result() as usize);
    router.dispatch_frame(conn_id, slice);
    // Recycle buffer ID back to the ring tail with Release ordering
    buf_ring.replenish(bid);
}

Guarding Against Ring Exhaustion Under Burst Fanout

If downstream backends slow down and hold references to frame slices across async await points, the provided ring runs dry (-ENOBUFS) and drops multishot registrations. Enforce a strict rule: parse header routing metadata synchronously, forward via scatter-gather SPLICE or registered TX slabs, and return the RX buffer ID before yielding.

End-to-End Verification

Across 100GbE Mellanox ConnectX-6 NICs, multishot receive rings reduced perf kernel syscall time from 34% to 9.8% at 1.1M RPS. You can inspect queue dwell times for this exact architecture using the per-CPU probes in Sub-1% Overhead Tail-Latency Histograms With Per-CPU eBPF Maps and see how batching simplifies quorum heartbeats in Deterministic Raft Lease Quorums Under Asymmetric Cross-AZ Jitter.

Connected Architecture Notes

Henrik Lindqvist

Henrik Lindqvist

Stockholm · UTC+1

Principal distributed systems architect writing weekly benchmarks on consensus protocols, storage engines, WebAssembly isolates, and tactile web accessibility.

Reader Field Notes

0 verified notes

No published field notes yet on this essay. Share a production observation or benchmark note below.

Contribute a Technical Note

Moderated manually for signal-to-noise. Your email is never stored in public comment properties.

Enter your display name.
Enter a valid email or leave blank.
Please write at least 8 characters.
Please confirm publication consent.

Continue Reading

All essays →

Get next Sunday’s benchmark by email

Full essay in plain HTML, zero tracking pixels, one-click unsubscribe.

Enter a valid email address (for example, name@domain.com).