Column A few years ago, developers knew that eBPF was a handy way to build firewalls, but now it’s used everywhere for everything. Prepare for io_uring to do the same.
Most people don’t know anything about Linux programming. Why should they? Linux, more than most operating systems, just works. But under the surface, there are programs like eBPF that are transforming the infrastructure under the operating system that we use every day.
As revealed this week, Microsoft chose to port eGMP in Windows instead of trying to duplicate its functionality with your own program. io_uring may become the next Swiss-Army tool for Linux developers.
Io_uring allows Linux to start an operation asynchronously and wait for it to finish. Unlike its asynchronous I/O (AIO) subsystem, its predecessor, io_uring uses a memory ring buffer shared between user space and the Linux kernel. This allows you to submit operations and collect the results without the need for time-consuming Linux kernel calls. Its API is complex, but if your applications are I/O-intensive, you’ll be rewarded with much higher performance.
When I say “lots” of I/O I mean massive I/O calls, gigabytes and more. And when I say “vastly improved,” I mean that, even in 2020, io_uring was up to 20x faster than old-style Linux AIO.
That kind of speed increase makes developers stand up and take notice. As Glauber Costa, CEO and founder of ChiselStrike, a backend-as-a-service company, said, “It fundamentally changes the way Linux applications are designed: instead of a flow of code that issues system calls when needed , that has to think about whether or not a file is ready, they naturally become an event loop that constantly adds things to a shared buffer, deals with previous entries that were completed, flushed, and repeated.”
Costa is not alone. At the Linux Foundation Europe Open Source Summit in Dublin, Senior Linux Kernel Developer Jonathan Corbet said in his summit speech on the state of the Linux kernel that io_uring is a game changer. It would make “the border between user space and kernel space porous”.
For most of Linux’s existence, there was only a slow, tight bridge of system calls between slow user space and fast kernel space processes.
As Corbet said: This “allows you to do some pretty complex things via the ring. In a sense, it’s becoming a separate API from the current system that allows you to load some simple program into the kernel and run the whole thing.” asynchronously and get the result when they happen. It’s a very different approach to programming on Unix-like systems, and people are starting to do interesting things with it.”
In the future, he sees the two almost merging for programming purposes, as the key memory ring buffer concept of io_uring is used in other fundamental Linux programming processes.
In an interview at the Linux Plumbers Conference, held at the same time as the Open Source Summit Europe, Linus Torvalds said that while io_uring is still new, “I think the technology is pretty sensible. I think it has proven itself in small areas. And people are starting to say, ‘Hey, I’d like to use this tool!'”
Torvalds isn’t so sure that io_uring will transform Linux programming, but he doesn’t rule it out either.
So, if you’re a serious Linux developer or just someone building high-performance computing, web servers, or DBMSs, check out io_uring. You’ll be glad you did. ®