4 ms·
Io_uring and Networking in 2023 [pdf]
- espoal 4y agoadded to awesome-iouring https://github.com/espoal/awesome-iouring https://github.com/espoal/awesome-iouring
- cormacrelf 4y agoIf you use io_uring to implement the Promise API, do you call it iou_ring?
- laerus 4y agoin the Future this will be funny
- svieira 4y agoThe only Task remaining is to wait until that Future is joined.
- kzrdude 4y agoWhy is it called "uring" anyway, what's the u for?
- erincandescent 4y agoUserspace
- wyldfire 4y agoThe letter u in contexts like these is usually used to represent the greek letter mu -- μ -- and like the SI units prefix indicates "micro". It might not be the case for io_uring, but that's what I'd assumed.
- taskforcegemini 4y agothat's what I thought as well. and something in relation to "micro kernel"
- WJW 4y agoThe "u" in "uring" has nothing to do with its size but rather with it being a "userspace ring". The ring buffers used by this particular API reside in userspace rather than in kernel memory.
- axboe 4y agoThis is correct, the "u" is for userspace/usermapped. The memory is actually allocate by the kernel, but it's mapped into the applications address space.
- loeg 4y ago> The ring buffers used by this particular API reside in userspace rather than in kernel memory. More specifically, the physical pages backing these ring buffers are pinned and mapped into both address spaces. (The kernel needs to be able to read submissions (sqes) off of it and write completions (cqes) into it, and could not do that if it were only mapped in userspace, or could be paged out.)
- localplume 4y agounlocked ring? the ring buffers are lock free. I'm not sure it stands for userspace since the ring buffers are shared between kernel and userspace, thats the core of io_uring, so that seems kind of misleading.
- riceart 4y agoRing buffers for the most part are typically lock free, so that’s a bit redundant. The special part is that the ring is directly accessible from userspace at all, as previously any ring buffer is internal.
- Conscat 4y agoI have struggled searching for any evidence, but most people seem to think it's "userspace".
- jswrenn 4y agodupe (2 days ago): https://news.ycombinator.com/item?id=34798281 https://news.ycombinator.com/item?id=34798281
- twic 4y agoAnd for some reason this time it's a PDF.
- znpy 4y agocould anyone suggest where to learn enough network programming in C/Linux to be able to have the necessary background to start using io_uring? After working on one of our internal pieces of software, I have a strong hunch that io_uring could boost its throughput, and I'd like to have a PoC, but low-level network programming is definitely outside my areas of expertise. Any suggestions ?
- hedora 4y agoFind a tutorial that explains how to implement an async runtime on top of epoll using C++20 coroutines. In that context, it is probably easier to use io_uring correctly than epoll.
- unmole 4y agoBeej's Guide to Network Programming: https://beej.us/guide/bgnet/ https://beej.us/guide/bgnet/
- mariusor 4y agoI just went through this recently, and it vastly predates io_uring functionality, I don't remember even mentioning it. It's a good place to learn socket programming using the POSIX sockets API, but that's it.
- unmole 4y agoThe GP asked for resources to understand low level network programming.
- mariusor 4y ago...relevant to io_uring. I was just clarifying that Beej's guide is not really that.
- benwills 4y agoAs someone who has written a fair amount of networking code in C, I'd assert that without an understanding of what's in Beej's guide, it will be nearly impossible to competently use io_uring in a networking context.
- twic 4y agoIn this code: for (i = 0; i < BUFS_IN_GROUP; i++) { /* add each buffer, we'll use i buffer ID */ io_uring_buf_ring_add(br, bufs[i], BUF_SIZE, i, io_uring_buf_ring_mask(BUFS_IN_GROUP), i); } Where did bufs come from? Should that be br.bufs[i]?
- cgh 4y agoI think so, yes. struct io_uring_buf_ring is a union that includes a bufs member: struct io_uring_buf bufs[0];
- axboe 4y agoThe buffers are supplied elsewhere outside that example, just consider it an array of pointers to buffers of size BUF_SIZE. br->bufs[] is the shared space, it holds information on the address/size/id of a given buffer.
- espoal 4y agoi think it should be br[i]
- bullen 4y ago"Fortunately, future work may make synchronization nonpinning. And, refactoring internals of the java.io package and implementing OS-level APIs such as io_uring on Linux may reduce the number of capturing operations." https://blogs.oracle.com/javamagazine/post/java-loom-virtual-threads-platform-threads https://blogs.oracle.com/javamagazine/post/java-loom-virtual...
- puzpuzpuz-hn 4y agoRecently we've started using io_uring for disk access in QuestDB. So far, it's being used in CSV import, but we'd like to expand it to network and other disk access use cases. Apart from the performance boost, the beauty of io_uring is that it allows one to build an event loop on a single I/O multiplexing mechanism. No need to build an ugly combination of epoll and AIO or anything like that - it supports networking, disk access, user events (eventfd), and timers (and not only).
- axboe 4y agoThank you for highlighting that, part of the design criteria for io_uring was indeed to be able to do everything. It's even mentioned in the second sentence of the linked write-up, no more "everything is a file... until you need to do IO to it".
- neverartful 4y agoHow does io_uring relate (if at all) to DPDK and SPDK?
- ilc 4y agoIt doesn't really. DPDK/SPDK are ways to directly to use the device involved. io_uring is a way to manage event flow between the kernel and userspace.