6 ms·
What Is Io_uring?
- v3gas 2y ago> Oct 2, 2024 From the future!
- boarush 2y agoI wonder if matklad has their scheduled blogs after penning them down?
- Brajeshwar 2y agoNice! I think he had a post marked for the future (the 32nd of September ), but his tool somehow published that; https://github.com/matklad/matklad.github.io/blob/master/content/posts/2024-09-32--what-is-io-uring.dj
- kzrdude 2y agoPublished already on 32nd september, wonderful.
- chrismorgan 2y agoI think the “32-” should have been “23”. Transposed digits and an extra hyphen-minus.
- larsrc 2y agoThis bit is unfortunate, I hope it improves: "You might want to avoid io_uring [if] you want to use features with a good security track record." At least he's clear about it.
- landr0id 2y agoI'm kind of curious what Alex meant by this, as the security problems relating to io_uring are, to my knowledge, unrelated to the user-space program. It makes sense if you want to disable the feature in your own kernel or remove potential sandbox escape attack surface, but it's like saying "You might want to avoid win32k if you want to use features with a good security track record" (and I know this is kind of apples to oranges but you get the point).
- FridgeSeal 2y agoIIUC io_uring surfaced a bunch of pre-existing-but-rarely-hit code paths that had issues, which was widely taken to mean “io_uring has issues”. Google also disabled it on all machines in GCP, not clear if Google disabled it because of the same issues, or some other thing. The aforementioned issues have been fixed.
- jclulow 2y agoThis article, and indeed much of the discourse about the facility out in the wild, could really use some expansion on at least these two points: > The application submits several syscalls by writing their codes & arguments to a lock-free shared-memory ring buffer. That's not all, though, right? Unless you're using the dubious kernel-driven polling thread, which I gather is uncommon, you _also_ have to make a submit system call of some kind after you've finished appending stuff to your submit queue. Otherwise, how would the kernel know you'd done it? > The kernel reads the syscalls from this shared memory and executes them at its own pace. I think this leaves out most of the interesting information about how it actually works in practice. Some system calls are not especially asynchronous: they perform some amount of work that isn't asynchronously submitted to some hardware in quite the same way as, say, a disk write may be. What thread is actually performing that work? Does it occur immediately during the submit system call, and is completed by the time that call returns? Is some other thread co-opted to perform the work? Whose scheduling quantum is consumed by this? Without concrete answers that succinctly describe this behaviour it feels impossible to see beyond the hype and get to the actual trade-offs being made.
- Tuna-Fish 2y ago> That's not all, though, right? Unless you're using the dubious kernel-driven polling thread, which I gather is uncommon, you _also_ have to make a submit system call of some kind after you've finished appending stuff to your submit queue. Otherwise, how would the kernel know you'd done it? Correct, the "check for new entries" system call is called io_uring_enter(). (0) > Some system calls are not especially asynchronous: they perform some amount of work that isn't asynchronously submitted to some hardware in quite the same way as, say, a disk write may be. What thread is actually performing that work? Does it occur immediately during the submit system call, and is completed by the time that call returns? Is some other thread co-opted to perform the work? A kernel thread. The submit system call can be optionally made to wait for completion, but by default it will always immediately return. > Whose scheduling quantum is consumed by this? That's a good question. The IO scheduler correctly sees them as belonging to the submitting thread, but if you issue a bunch of computation-heavy syscalls, I would not be surprised if they were not correctly accounted for. (0) https://unixism.net/loti/ref-iouring/io_uring_enter.html#c.io_uring_enter https://unixism.net/loti/ref-iouring/io_uring_enter.html#c.i...
- watt 2y agoio_uring also caused a ton of problems for our containers in Kubernetes when Node 20 had enabled it by default. They scrambled and turned it off by default in https://github.com/nodejs/node/commit/686da19abb https://github.com/nodejs/node/commit/686da19abb
- clhodapp 2y agoThat sounds like a dubious integration contract for initialization between libuv and node, not an issue with io_uring. I would assume the same thing would happen if they used traditional Posix APIs to open file handles before dropping their privileges.
- sapiogram 2y agoI'm extremely curious, what kinds of problems? We had entire Kubernetes nodes becoming unresponsive, and I think io_uring in Node 18.18.0 was responsible, but they had lots of stuff running on them so I was never able to pinpoint the exact cause.
- deleted 2y ago[deleted]
- markles 2y agoI've been playing with io_uring for the last month or so, just for fun. I'm working on building an async runtime from scratch on top of it. I've been documenting (think of them more as notes to myself) the process thus far: Creating bindings to io_uring (just to see the process): https://www.thespatula.io/rust/rust_io_uring_bindings/ https://www.thespatula.io/rust/rust_io_uring_bindings/ Writing an echo server using those bindings: https://www.thespatula.io/rust/rust_io_uring_echo_server/ https://www.thespatula.io/rust/rust_io_uring_echo_server/
- lukeh 2y agoDitto Swift. I should probably write a blog post about it... https://github.com/PADL/IORingSwift https://github.com/PADL/IORingSwift
- twen_ty 2y agoSo it's 2024 and Linux still doesn't have what Windows NT had 30 years ago?
- yencabulator 2y agoMust be weird trying to explain why Windows had to introduce a new API that they've apparently already had for 30 years. https://learn.microsoft.com/en-us/windows/win32/api/ioringapi/ https://learn.microsoft.com/en-us/windows/win32/api/ioringap...
- asveikau 2y agoThe async I/O model is one that NT had for all that time. The idea of using a ring data structure to do faster syscalls is what's new. io_uring represents both a pivot to an NT style I/O model (true async instead of readiness as in epoll) using a new syscall interface.
- jart 2y agoAre you saying io_uring is basically IOCP for Linux? If that's true, then I'm not happy about it being in the kernel. IOCP only goes 2x faster in my experience (vs. threads and blocking i/o) and that isn't worth it for the ugly error prone code you have to write. System calls are also a lot faster on Linux than they are on Windows, so I'd be surprised if io_uring manages even that.
- rwmj 2y agoAlthough I'm a fan of io_uring, a reason to avoid io_uring is it involves quite major program restructuring (versus traditional event loops). If you don't want to forever depend on Linux >= 6 but also support other OSes then you'll have to maintain both versions.
- deleted 2y ago[deleted]