Tech News
← Back to articles

Io_uring is not an event system [2021]

read original related products more articles

16 June, 2021 Rob Norris Permalink io_uring is not an event system

I’ve been hearing about io_uring on and off for the last couple of years. Its a relatively new technology in Linux to allow high-performance IO with very few overheads.

Whenever its been mentioned, its usually been presented as a new alternative to select , poll and epoll . This led me to believe that it was just the next iteration of those facilities, which is to say, another facility to inform a program that something has happened on a file or network socket or whatever, so that it can take action. In other words, and incremental improvement, presumably with fewer overheads, but otherwise just more of the same. Which is great, but boring for me: I understand the concept well, but these days I run other peoples’ software and don’t really write my own, so I haven’t cared too much about the finer details.

Then last week I was watching Brendan Gregg’s LISA21 talk “Computing Performance: On The Horizon”, and this slide caught my eye:

I don’t know if it was the promise of “faster syscalls” or the diagram, but something told me there was more to io_uring than I realised. I didn’t know what, but enough that I thought I figured I should try it out.

Thinkng it was a new kind of descriptor readiness facility, I thought to just write a dumb multiuser telnet chat server. This kind of program was bread-and-butter for me once, long ago - writing MUD-like chat servers was where I got my start learning C, UNIX and network programming. As it turns out though, that was too long ago, and most of the interesting information had fallen out of my head.

So, I devised yoctochat: a sort of shape for the simplest possible chat server, implemented multiple times using a different descriptor readiness facility each time. I started with one for select , then one for poll . The epoll version tool a little longer because I’d never used it before, but since its more of the same, the shape was basically the same.

With those out of the way, and a clear understanding of what these programs are, even are, a couple of days ago I started on yc_uring.c . After a few abortive starts I started to get a feel for things and it began to take shape. Later, I stopped to do some house chores and was thinking about the shape of the program I was building, and it hit me:

io_uring is not an event system at all. io_uring is actually a generic asynchronous syscall facility.

And now suddenly I see what the fuss is about!

... continue reading