Getting Hands-on with io_uring using Go
developers.mattermost.com
developers.mattermost.com
disclaimer - I used to work at ScyllaDB
https://github.com/golang/go/issues/31908
TL;DR there's no ETA for it.
1. Programs that do a lot of IO to and from regular files, and that don't want to bother with a thread pool. For this reason I would expect to see it land in the golang runtime, and in other event loop implementations like libuv.
2. Legitimately IO bound programs, which can use SQ polling. Other users of aio fall in this category, as well as qemu.
For everything else, it looks like epoll is still mostly an equivalent choice to io_uring? Has anyone got any benchmarks for using io_uring in a typical network daemon, i.e. something that would generally be bound by socket I/O?
And with the 5.7 changes you can do polling + buffer selection + reading for any number of sockets with a single syscall[0].
That does seem useful. But wouldn't you want to put this into a library that falls back to a thread pool approach on older kernels? And in that case, it seems like the application doesn't particularly care what the underlying implementation is? Since it's not built around asynchronous execution it just calls some function that blocks until the CQ is complete. This appears to be what the golang runtime will have to do.
>And with the 5.7 changes you can do polling + buffer selection + reading for any number of sockets with a single syscall
Thank you, this is very close was what I was looking for. (It hasn't made its way into the manpages yet)
That was mostly meant as an example of the more general case where using io-uring can reduce overhead of any kind of IO operation, even when they're not the primary focus of your application.
The point is that yes, io-uring is great for event-based, asynchronous libraries. But even traditional synchronous code can make significant gains by switching to it. As the article hints with its package name: io-uring is the one ring to bind them all.
> This appears to be what the golang runtime will have to do.
The go standard library can tie io-uring into its goroutine scheduler. When doing IO it suspends the green thread, submits the work to IO uring and polls the completion queue of the ring when looking for tasks that need to be woken up.
Source: recently developed a web server that uses io_uring.
Author here. Some folks have been writing echo server implementations in io_uring and doing some benchmarks: https://github.com/CarterLi/io_uring-echo-server.
May not be your typical network daemon, but you can still look at the relative gains.
Generally speaking, io_uring is just a general-purpose programming model to interface with the kernel. Socket I/O is just one part of the story. But when combined with other things, it becomes much more powerful.
I've been confused by the name for ages. I now can parse it as IO Userpace RING, rather than some sort of typo!
To add to what couchand said, there are already comparisons of io_uring with SPDK and they are pretty close. So I would expect near about the same result for DPDK too.
I don't think this is correct--ring buffers still require a mutex to prevent the producer from updating the write pointer while the reader checks the write pointer.
https://stackoverflow.com/questions/871234/circular-lock-fre...
https://stackoverflow.com/questions/52522512/do-i-need-a-mut...
The people over at enqueuezero have a nice article about lock free queues at https://enqueuezero.com/lock-free-queues.html.