HeadlinesBriefing favicon HeadlinesBriefing.com

io_uring overtakes epoll for Linux async I/O

Hacker News •
×

When a class project turned into a production‑ready reverse proxy, the author quickly hit the limits of a naïve worker model. The first version of Tiny Gate performed modestly, but benchmarks showed it could not challenge nginx or HAProxy. Seeking a real lift, the team rebuilt the proxy around Linux’s asynchronous I/O facilities and explore how kernel‑level queues affect latency.

The initial rewrite swapped the custom loop for epoll, Linux’s long‑standing readiness API. epoll signals when a descriptor can be read or written, but each event still requires separate read/write syscalls, doubling the user‑kernel transitions. On a high‑connection workload this overhead dominates, delivering only a modest speedup over the original code, which becomes a bottleneck as connections climb into the tens of thousands.

A second overhaul adopted io_uring, introduced in kernel v5.1 (2019). Instead of polling for readiness, io_uring queues submissions and returns completions, collapsing many operations into a single batch syscall or, with SQPOLL, virtually none. The approach shifts work into the kernel, cuts context switches, and enables zero‑copy tricks such as IORING_OP_SEND_ZC on kernels 6.0+. The author concludes io_uring now supersedes epoll for modern Linux services.