Next magic Linux program to will change the world? Io_uring • The Register

2022-09-16 22:22:58 By : Mr. Runh Power

Column A few years ago developers knew eBPF as a handy way to build firewalls yet now it's used everywhere for everything. Get ready for io_uring to do the same.

Most people don't know the first thing about Linux programming. Why should they? Linux, more so than most operating systems, just works. But under the surface, there are programs such as eBPF that are transforming the infrastructure under the operating system we use every day.

As revealed this week, Microsoft chose to port eBPF into Windows rather than try to duplicate its functionality with its own program. io_uring may become the next Swiss-Army tool for Linux developers.

Io_uring allows Linux to launch an operation asynchronously and wait for its completion. 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 enables it to submit operations and collect the results without needing time-expensive Linux kernel calls. Its API is complex, but if your applications require lots of I/O, you get rewarded with vastly improved increased performance.

When I say "lots" of I/O I mean massive I/O calls, gigabytes and beyond. And when I say "vastly improved," I mean even back in 2020, io_uring was up to 20 times faster than old-style Linux AIO.

That kind of speed boost 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 to be designed: Instead of a flow of code that issues syscalls when needed, that have to think about whether or not a file is ready, they naturally become an event-loop that constantly add things to a shared buffer, deals with the previous entries that completed, rinse, repeat."

Costa's not alone. At the Linux Foundation's Open Source Summit Europe in Dublin, senior Linux kernel developer Jonathan Corbet said in his State of the Linux Kernel summit speech that io_uring is a game changer. It would "make the boundary between user space and kernel space porous."

For most of Linux's existence, there was only a narrow slow 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 by way of the ring. It is, in a sense, becoming a separate API to the current system that allows you to load some simple program into the kernel and execute it all asynchronously and just get the result when they happen. It's a very different approach to programming on Unix-type systems, and people are starting to do interesting things with it."

In the future, he sees the two almost merging for programming purposes as io_uring's key memory ring buffer concept is used in other fundamental Linux programming processes.

In an interview at the Linux Plumbers Conference, held at the same time as Open Source Summit Europe, Linus Torvalds said that while io_uring is still new, "I think the technology is fairly sane. I think it has proven itself in small areas. And people are starting to say, 'Hey, I would like to use this tool!'"

Torvalds isn't as sure that io_uring will transform Linux programming, but he's not ruling it out, either.

So, if you're a serious Linux developer or just someone who builds High Performance Computing, Web servers, or DBMSs, check io_uring out. You'll be glad you did. ®

The Register - Independent news and views for the tech community. Part of Situation Publishing

Biting the hand that feeds IT © 1998–2022