7 ms·
Io uring
- funerr 3y agoShameless plug, I just finished 30+ hours of research into io_uring and posted a more high-level summary here: https://unzip.dev/0x013-io_uring/ https://unzip.dev/0x013-io_uring/ Including a tl;dr, pros, cons, tools & players, and a forecast. The creator of io_uring Jens was super nice and also reviewed it (I'm still a bit in shock).
- michaelevyg 3y agoGreat summary! thanks for sharing!
- funerr 3y agoHappy to help!
- tomgs 3y agoVery nicely done! I like this format
- funerr 3y agoThanks tomgs! I have this format for every new dev trend I find, keeps it structured.
- sylware 3y agoModern hardware does already work like that. Look at AMD gpu command buffers, and xHCI (and NVMe). But among those "ring buffers", which one is the best? (from a consumer/producer concurrent access, on a modern CPU ofc). If the commands are not convoluted, the programming is soooo much simpler and cleaner.
- phone8675309 3y agoThe article mentions the names for the queues are based on the NVMe standard.
- sylware 3y agohuh, ofc I only have experience with ring buffers from AMD gpus and USB xHCI controllers, and only heard that NVMe has ring buffers. It seems USB xHCI is the "most concurrent friendly" and hardwarely friendly (IOMMU and non-IOMMU) as it supports "sparse ring buffers" (non continous in bus address space). AMD gpu ring buffers are atomic read/write pointers (command ring buffers and "interrupt"/completion ring buffers) with doorbells to notify pointer updates. I should have a look at linux IO uring to see how far they did go and which model they did choose. I wonder how modern hardware could use anything else than command ring buffers.
- rain1 3y agoThis is the future of linux syscalls. Get on board with this or get left behind.
- PhilipRoman 3y agoI'm not sure if you're being sarcastic or not. This is a specialized case for improving performance. 99% of applications you use every day will not benefit from io_uring in any measurable way.
- obiefernandez 3y agoGot a huge is that who I think it is when I saw HN homepage this morning. Author is a well-known legend in Atlanta tech scene, especially amongst Georgia Tech alum in their 30s and 40s. His stories and rants on Facebook are legendary
- thrwwy646b97b8 3y ago[flagged]
- obiefernandez 3y agoLots of other entertaining entries on that wiki if you look for them. “this is the wiki of nick black (aka dank), located at 33°46′44.4"N, 84°23'2.4"W (33.779, 85.384) in the heart of midtown atlanta. dankwiki's rollin' wit' you, though I make no guarantees of its correctness, relevance, nor timeliness. track changes using the recent changes page. I've revived DANKBLOG, this wiki and grad school having not satisfied ye olde furor scribendi. hack the planet! don't mistake my kindness for weakness. i primarily write to force my own understanding, and remember things (a few entries are actually semi-authoritative). i'm just a disreputable Mariner on your way to the Wedding. if you derive use from this wiki, consider yourself lucky, and please get confirmation before relying on my writeups to perform surgery, design planes, determine whether a graph G is an Aanderaa–Rosenberg scorpion, or feed your pet rhinoceros. do not proceed if allergic to linux, postmodern literature, nuclear physics, or cartoonish supervillainy. “
- tomjakubowski 3y agowhoa holdonaminute, dank is dan kegel's nick…
- dankamongmen 3y agoalso dan kaminsky's and to a lesser degree dan knapp's. i was put on the spot as a sixteen year old Georgia Tech freshman acquiring his college of computing account, and between a love of good weed and childish stupidity, i chose "dank@". twenty-five years later, i'm not about to change it. no insults are meant to any of the aforementioned hax0rs.
- iamwil 3y agoOne interesting thing is that io_uring can operate in different modes. One of the modes enables kernel-side polling, so that when you put data into the buffer, the kernel will pull the data out itself to do IO. That means from the application side, you can perform IO without any system calls. Our general take was also that it has a lot of potential, but is relatively low level that most mainstream programmers aren't going to pay attention to it. Hence, it'll be a while before it permeates through various ecosystems. For those of you that like to listen on the way to work, we cover io_uring on our podcast, The Technium. https://www.youtube.com/watch?v=Ebpnd7rPpdI https://www.youtube.com/watch?v=Ebpnd7rPpdI https://open.spotify.com/episode/3MG2FmpE3NP7AK7zqQFArE?si=sKNKcrIZRayMeQGTbwkMlw&nd=1 https://open.spotify.com/episode/3MG2FmpE3NP7AK7zqQFArE?si=s...
- eru 3y ago> Our general take was also that it has a lot of potential, but is relatively low level that most mainstream programmers aren't going to pay attention to it. Hence, it'll be a while before it permeates through various ecosystems. Isn't that what libraries are for?
- ori_b 3y agoAs long as you are willing to accept the latency and/or busy looping that the kernel needs in order to poll.
- blibble 3y ago> Hence, it'll be a while before it permeates through various ecosystems. this may take a while as it's a completely different IO model it took us 30 odd years to get from select/epoll to async/coroutines being popular
- mrcode007 3y agoWindows has been using this mechanism for well over a decade now. It’s called IOCP (IO completion ports)
- 3y ago
- deleted 3y ago[deleted]
- davidw 3y agoThat's sort of a wall of text. I'd be curious to see 1. A Hello World, absolute minimum example and 2. Doing something it's designed to do well, cut down to as small an example as possible. Sheez, downvoters, I'm curious about it, and want to see an example. You don't learn to drive a car by reading the engine specs, either.
- thinkharderdev 3y agoYou can find some hello world level examples here https://github.com/axboe/liburing/tree/master/examples https://github.com/axboe/liburing/tree/master/examples. Right now, what it can do really well is non-blocking file IO. My (limited) understanding is that as of now, the benefits of io_uring over epoll for network IO is a bit more ambiguous. That said, io_uring is adding new features (already available in linux 6 kernel) that are really promising. See https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023 https://github.com/axboe/liburing/wiki/io_uring-and-networki....
- gavinray 3y agoYou can find some "hello-world" style examples here, along with fantastic tutorial materials: https://unixism.net/loti/tutorial/index.html https://unixism.net/loti/tutorial/index.html
- thinkharderdev 3y agoI've tinkered around with io_uring on and off for the last couple years. But I think it's really becoming quite cool (not that it wasn't cool before... :)). This was a really interesting post on what's new https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023 https://github.com/axboe/liburing/wiki/io_uring-and-networki.... The combination of ring-mapped buffers and multi-shot operations has some really interesting applications for high-performance networking. Hoping over the next year or two we can start to see really bleeding edge networking perf without having to resort to using DPDK :)
- greatest-ape 3y agoI’ve achieved great preliminary results with this in https://github.com/greatest-ape/aquatic#io_uring https://github.com/greatest-ape/aquatic#io_uring
- thinkharderdev 3y agoReally cool. I've spent a lot of time digging through your code in aquatic :) It's a really cool project!
- martinjacobd 3y agoI recently tinkered around with io_uring for a presentation. Here is a toy echo server I made with it: https://gist.github.com/martinjacobd/be50a93744b94749339afe896129a039 https://gist.github.com/martinjacobd/be50a93744b94749339afe8... (non io_uring example for comparison: https://gist.github.com/martinjacobd/feea261d2fafe5e7332e37dc96f9479e https://gist.github.com/martinjacobd/feea261d2fafe5e7332e37d...) A big todo I have for this is to modify it to accept multishot_accept but I haven't been able to get a recent enough kernel configured properly to do it. (Only >6.0 kernels support multishot accept). (edit) you need to s/multishot_accept/recv_multishot/g above :)
- thinkharderdev 3y agoI did an echo server with multi-shot here (using the io_uring rust bindings) https://github.com/thinkharderdev/io-uring/blob/ring-mapped-buffers/examples/tcp_echo_buf_ring.rs https://github.com/thinkharderdev/io-uring/blob/ring-mapped-.... My biggest issue with io_uring is figuring out what is available in which kernel version :)
- martinjacobd 3y agoI meant recv_multishot not multishot_accept. The one I linked does use multishot_accept. Just a think-o. Looks like your version uses both though, so that's cool.
- wazzaps 3y agothis might help: https://sourcedigger.io https://sourcedigger.io
- thinkharderdev 3y agoOh that's awesome! Thanks!
- samsquire 3y agoI might have to use your code again, I used your Just in time compilation code to execute generated machine code. Thank you so much Martin Jacob!
- jupp0r 3y agoWould be great if this was integrated into runtimes like tokio. I can totally see graphs of promise chains being translated to calls to io_uring representing the underlying data dependencies and thus saving lots of overhead context switches. Pretty cool to see how far IO APIs have come with this.
- Tanjreeve 3y agoThere already is a tokio_uring. I'm still a bit dubious how much help it is for application level stuff outside of normal file operations. E.g the data dependencies stuff is a very granular scheduling operation to generalise in an easy to use way. But it's definitely real and worth watching.
- FridgeSeal 3y agoAs fantastic as Tokio uring is, it only uses the uring interface for locals files, and not for the network access parts. Glommio is a thread-per-core async executor/framework that supports io_uring however.
- nomaxx117 3y agoMaintainer of tokio-uring here. It uses io_uring for the network APIs as well.
- FridgeSeal 3y agoOh rad, my bad! I read a while back that it only did fs, that was clearly incorrect/outdated/etc.
- porsager 3y agoThe already insanely fast (probably the fastest) http/websocket server uWebSockets is seeing a 40% improvement with io_uring in initial tests! https://github.com/uNetworking/uWebSockets/issues/1603#issuecomment-1555943151 https://github.com/uNetworking/uWebSockets/issues/1603#issue...
- Taywee 3y agoWhile impressive, that is a project that is basically perfectly suited to gain the most from this kind of optimization, and the fact that it already was incredibly fast means that there are fewer low hanging fruits for performance, and other projects would be less likely to have as big wins (as they're more likely to already have bigger bottlenecks elsewhere).
- klabb3 3y agoThat’s really promising! uSockets/uWebSockets is an almost perfect use case for io_uring. That library is also insanely performant and well written. I ran some benchmarks mostly for low memory overhead and it’s much better than even Go std, nginx+nchan etc etc.
- lloydatkinson 3y ago[flagged]
- gigatexal 3y agoio_uring is the single coolest thing to come out of facebook
- PeterCorless 3y agoTesting at ScyllaDB showed that io_uring could be >3x the throughput of posix-aio, and 12% faster than linux-aio. This is back in 2020, so I am sure that there's been a lot of work done since then. https://www.scylladb.com/2020/05/05/how-io_uring-and-ebpf-will-revolutionize-programming-in-linux/ https://www.scylladb.com/2020/05/05/how-io_uring-and-ebpf-wi...