Linux io_uring: Async I/O Patterns We Use
io_uring replaces epoll for new high-throughput services. The patterns that earn their place, the gotchas in older kernels, and where we'd still pick epoll.
Key takeaways
- io_uring is Linux's ring-buffer async I/O interface, added in kernel 5.1, that handles network, file and syscall work through one submission and completion queue.
- It beats epoll for mixed or storage-heavy workloads and batched submissions.
- For simple network services, older kernels or runtimes built on epoll, epoll remains the safer choice.
On this page
io_uring is worth it when a service mixes network and file I/O or needs to batch thousands of operations per syscall: you queue work in a shared submission ring and collect results from a completion ring. For a plain socket service on an epoll-based runtime, stay on epoll. Plan on kernel 5.19 or newer for the server patterns below.
Verified against
Linux 7.3 mainline and the 6.18, 6.12, 6.6, 6.1, 5.15 and 5.10 longterm lines (per kernel.org), liburing 2.15, against the liburing man pages io_uring(7), io_uring_setup(2) and io_uring_prep_multishot_accept(3). Checked October 2026.
epoll was the right async I/O answer on Linux for almost two decades, and for socket-heavy services it still is. But once a service is doing a mix of network I/O, file I/O and other syscalls, epoll becomes one of several mechanisms per operation rather than a single one, because epoll readiness means nothing for regular files. io_uring changed that: submit operations to a ring buffer, the kernel processes them asynchronously, you collect completions. Same interface for everything.
The mental model
epoll asks "which file descriptors are ready?" io_uring says "do these things and tell me when each one is done."
Two ring buffers are shared between userspace and the kernel:
- Submission Queue (SQ). Userspace writes operations here: read this, write that, accept on this socket.
- Completion Queue (CQ). The kernel writes results here. Userspace polls or waits for completions.
The kernel processes the SQ asynchronously. Operations that can complete immediately (cached reads, small writes) may finish inline; slow ones complete later. From userspace you don't care: you submit, you eventually get a completion, and you match it to the request through its user_data field.
Where io_uring beats epoll
Mixed workloads. A service doing socket reads, disk reads and openat() calls used to need epoll plus a thread pool for the file work plus careful coordination. io_uring handles all three through the same ring. Big simplification.
Batching. Submit many operations in one io_uring_enter call. epoll's epoll_ctl is one syscall per registration change, and every read or write is another syscall on top; the ring amortizes that cost.
Storage-heavy services. For NVMe-backed databases or storage gateways, SQPOLL (below) can take the submission syscall off the hot path entirely.
Where epoll still wins
Pure-network services with small requests. When each request is a few KB and the time goes to a database call, kernel-side I/O isn't the bottleneck, and epoll is supported by every framework.
Older kernels. io_uring features keep landing release by release. A fleet stuck on an old kernel has basic io_uring but misses the features that make servers pleasant, such as multishot accept. epoll works everywhere.
Libraries you don't control. If your dependencies use epoll under the hood (Node's libuv, most Python async libraries), the io_uring win is partial: only the parts you wrote can use it.
Our split: io_uring for new high-throughput Rust services, epoll for everything already running on an epoll-based runtime.
Kernel version requirements
io_uring landed in Linux 5.1, and each later release added features. The version gates we plan around, per the liburing man pages:
- 5.11: SQPOLL no longer requires registered files, and unprivileged use is allowed with
CAP_SYS_NICE. - 5.13: SQPOLL needs no special privileges.
- 5.19: multishot variants, including multishot accept.
- 6.0 / 6.1:
IORING_SETUP_SINGLE_ISSUERandIORING_SETUP_DEFER_TASKRUN.
As of October 2026, kernel.org lists 5.10 and 5.15 as the oldest longterm lines still maintained, and 5.4 is gone. We treat 6.1 as the floor for new io_uring services, which also covers every gate above. Check before you build:
$ uname -r
6.12.115
The patterns we use
A few that earn their place day to day.
1. Linked operations
IOSQE_IO_LINK tells the kernel not to start the next request until the previous one completes successfully; if one fails (a short write counts), the rest of the chain completes with -ECANCELED. The textbook use is a durable append: write, then fsync, in one submission.
// audit-log append: write then fdatasync, one io_uring_submit()
struct io_uring_sqe *sqe;
sqe = io_uring_get_sqe(&ring);
io_uring_prep_write(sqe, log_fd, buf, len, offset);
sqe->flags |= IOSQE_IO_LINK; /* fsync waits for the write */
io_uring_sqe_set_data64(sqe, REQ_WRITE);
sqe = io_uring_get_sqe(&ring);
io_uring_prep_fsync(sqe, log_fd, IORING_FSYNC_DATASYNC);
io_uring_sqe_set_data64(sqe, REQ_FSYNC);
io_uring_submit(&ring); /* two operations, one syscall */
The io_uring(7) page also recommends links for ordered sends and receives on one socket. Links don't let you feed one result into the next request, so "accept then recv on the new fd" needs either a second submission or direct (fixed) descriptors.
2. Multishot accept
Instead of submitting a new accept after each completion, submit one multishot accept that posts a completion for every incoming connection until it is cancelled or errors out. That removes the resubmit from the hot path. It needs kernel 5.19 or newer; check IORING_CQE_F_MORE on each completion, because when it's missing the multishot request has ended and you must re-arm it.
3. Registered file descriptors
For long-lived descriptors (your listen socket, your database connections), register them with the ring. Later operations reference them by index instead of descriptor, which saves a lookup and reference-count work in the kernel.
4. SQPOLL: kernel-side polling thread
The most aggressive optimization. Set IORING_SETUP_SQPOLL and the kernel starts a thread that polls the submission queue. You stop calling io_uring_enter for submissions; you just write to the SQ. After sq_thread_idle milliseconds without work the thread sleeps and sets IORING_SQ_NEED_WAKEUP, so your code must check that flag and wake it.
The trade: that kernel thread spins and burns a core. Worth it for the highest-throughput services; overkill otherwise. We enable it on one service at a time, with a before-and-after CPU comparison, never by default.
Gotchas we hit
Buffer lifetime. Submitted buffers must stay valid until completion, and with SQPOLL every pointer in a request must stay valid until it completes. Submit a read and then realloc the buffer, and the kernel writes into freed memory. Subtle to debug.
Inflight operations on shutdown. Drain or cancel outstanding requests before calling io_uring_queue_exit. Tearing a ring down with work in flight is where older kernels behaved worst.
Completion ordering. The io_uring(7) page is explicit: requests can complete in any order, even though they are attempted in ring order. Code that assumes "this finishes before that" needs links or explicit serialization.
Resource limits. Each ring uses kernel memory for the rings and any registered buffers, which are pinned. If ring setup or buffer registration starts failing at scale, check the process's RLIMIT_MEMLOCK before blaming the kernel.
Missing syscall wrappers. glibc does not wrap the io_uring syscalls. Use liburing (the official library, 2.15 as of October 2026) rather than raw syscalls.
Language support
- C / C++:
liburingis the official wrapper and is actively maintained. - Rust:
tokio-uringandglommio. tokio-uring sits alongside tokio for hybrid epoll and io_uring; glommio is a separate thread-per-core runtime built on io_uring. - Go and Python: limited. Go's runtime and Python's asyncio both use epoll; third-party io_uring wrappers exist but are not widely adopted.
- JVM: Netty offers an io_uring transport.
When io_uring is the wrong tool
A service doing 100 requests per second, CPU-bound logic, a fleet below 5.19, or a team without before-and-after benchmarks: in all four cases the complexity buys nothing. Published benchmark numbers rarely transfer, so measure your own workload. For per-operation latency on a live box, bpftrace one-liners can show what the kernel side is doing, and the CPU split between user and kernel time tells you whether work actually moved.
Questions people ask
Is io_uring faster than epoll?
For mixed network and file workloads, batched submissions, and storage-heavy services, usually yes, because one io_uring_enter call can submit many operations and registered buffers and descriptors cut per-operation overhead. For a plain socket service with small requests, the difference is often noise, since the kernel I/O path isn't the bottleneck. Benchmark your own workload before switching.
What kernel version do I need for io_uring?
io_uring first shipped in Linux 5.1, but the useful server features came later: unprivileged SQPOLL in 5.13 and multishot accept in 5.19, according to the liburing man pages. We use 6.1 as the practical floor because it also includes SINGLE_ISSUER and DEFER_TASKRUN. Check uname -r on every node class, including CI runners.
Does io_uring guarantee completion order?
No. The io_uring(7) man page states requests can complete in any order, even though the kernel attempts them in ring order. Tag each request with user_data and match completions to it. When order matters, such as write followed by fsync, chain the requests with IOSQE_IO_LINK so the kernel starts the next one only after the previous one succeeds.
What to read next
io_uring doesn't matter until syscall costs show up in your profile. For most services epoll is fine; for the few where CPU per request shows up in the bill, it's the difference between scaling linearly and not.
- Linux performance tuning for containers and Kubernetes nodes: the node-level knobs to check before rewriting your I/O layer
- eBPF tools for everyday ops: bpftrace patterns: observing io_uring kernel-side
- Container resource limits: what they actually do: kernel resource accounting under containers
- ext4 vs XFS vs Btrfs: the storage layer underneath your file I/O
Sources
Cite this article
Kiril Urbonas (2026). Linux io_uring: Async I/O Patterns We Use. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/linux-io-uring-async-io-patterns
[Linux io_uring: Async I/O Patterns We Use](https://www.devopsness.com/blog/linux-io-uring-async-io-patterns) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)
More from Linux
Explore more articles in this category
CVE-2026-98432: The CVSS 9.8 Linux TCP Bug Now Has an Exploit. Patched Node Images
A use-after-free in the IPv4 TCP handshake, present since Linux 4.4, now has a working exploit against MPTCP listeners, and every Go 1.24+ server is one by default. Which kernels are fixed and how to roll them through EKS, GKE and AKS.
CERN Left Red Hat for Debian: The CPU Baseline Lesson
CERN is moving accelerator control computers to Debian because RHEL raised its minimum CPU level. Check your own fleet's x86-64-vN support before the next OS upgrade does it for you.
ext4 vs XFS vs Btrfs: Choosing a Filesystem for a Server
The default filesystem your distro picks is not always the right one for your workload. Here is what actually differs and when each one wins.
You might have missed
Evergreen posts worth revisiting.