News for hackers. Stuff that matters.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by tyingq on Sunday May 10, 2020 @10:50AM (#23133040)
There are some benchmarks that show io_uring as a significant boost over aio: https://www.phoronix.com/scan.php?page=news_item&px=Linux-5....

I see that nginx accepted a pull request to use it, mid last year: https://github.com/hakasenyang/openssl-patch/issues/21

Curious if it's also been adopted by other popular IO intensive software.

Re:Lord of the io_uring: io_uring tutorial, examples and ref... by shuss on Sunday May 10, 2020 @11:09AM (#23133200)
Oh, yeah. QEMU 5.0 already uses io_uring. In fact, it uses liburing. Check out the changelog: https://wiki.qemu.org/ChangeLog/5.0
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by Twirrim on Sunday May 10, 2020 @11:23AM (#23133319)
To save people time, there's a single reference to it on the changelog:

> The file-posix driver can now use the io_uring interface of Linux with aio=io_uring

side note: I did note a change we built made it in to a released version of qemu:

> qemu-img convert -n now understands a --target-is-zero option, which tells it that the target image is completely zero, so it does not need to be zeroed again.

That's saving us so much time and I/O

Re:Lord of the io_uring: io_uring tutorial, examples and ref... by frevib on Sunday May 10, 2020 @03:47PM (#23135507)
Echo server benchmarks, io_uring vs epoll: https://github.com/frevib/io_uring-echo-server/blob/io-uring...
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by tele_ski on Sunday May 10, 2020 @10:09PM (#23138229)
Nice, reading through the epoll implementation shouldn't it re-register to make sure the send() call won't block? Looks like it only non-blocks on the accept socket and then a single read register
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by frevib on Wednesday May 13, 2020 @01:54AM (#23163891)
Could elaborate on “re-register”? It does not do short writes, if that’s what you mean.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by tele_ski on Thursday May 14, 2020 @01:16AM (#23175592)
Normally I'd expect an epoll implementation to epoll_ctl to make sure the socket can be written to without blocking. In this benchmark it probably makes no difference but I would think it would make the results a little more inline with a real applications usage of epoll.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by frevib on Friday May 15, 2020 @04:22PM (#23196967)
This a bare minimal echo server for educational purposes. It is not inline with a real world event loop.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by tele_ski on Sunday May 17, 2020 @04:43PM (#23215281)
Yeah I understand that, but if you are going for identical performance characteristics of how epoll would normally be used then I would expect it to re-register. Thats all I was getting at.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by jandrewrogers on Sunday May 10, 2020 @11:38AM (#23133447)
I have not adopted io_uring yet because it isn't clear that it will provide useful performance improvements over linux aio in cases where the disk I/O subsystem is already highly optimized. Where io_uring seems to show a benefit relative to linux aio is more naive software design, which adds a lot of value but is a somewhat different value proposition than has been expressed.

For software that is already capable of driving storage hardware at its theoretical limit, the benefit is less immediate and offset by the requirement of having a very recent Linux kernel.

Re:Lord of the io_uring: io_uring tutorial, examples and ref... by shuss on Sunday May 10, 2020 @12:22PM (#23133805)
For regular files, aio works async only if they are opened in unbuffered mode. I think this is a huge limitation. io_uring on the other hand, can provide a uniform interface for all file descriptors whether they are sockets or regular files. This should be a decent win, IMO.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by jandrewrogers on Sunday May 10, 2020 @01:13PM (#23134221)
That was kind of my point. While all of this is true, these are not material limitations for the implementation of high-performance storage engines. For example, using unbuffered file descriptors is a standard design element of databases for performance reasons that remain true.

Being able to drive networking over io_uring would be a big advantage but my understanding from people using it is that part is still a bit broken.

Re:Lord of the io_uring: io_uring tutorial, examples and ref... by g8oz on Sunday May 10, 2020 @02:54PM (#23135048)
The ScyllaDB developers wrote up their take here: https://www.scylladb.com/2020/05/05/how-io_uring-and-ebpf-wi...
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by jabl on Sunday May 10, 2020 @03:16PM (#23135264)
Those benchmark results are pretty impressive. In particular, io_uring gets the best performance both when the data is in the page cache and when bypassing the cache.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by shuss on Sunday May 10, 2020 @01:46PM (#23134475)
True. Have to agree, here. Although one advantage over aio for block I/O that io_uring will still have is to use polling mode to almost completely avoid system calls.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by wbl on Sunday May 10, 2020 @12:41PM (#23133979)
And works is used advisedly. Certain filesystem edge conditions particularly metadata changes due to block allocation can result in blocking behavior.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by tyingq on Sunday May 10, 2020 @11:41AM (#23133469)
If I understand the premise right, it should be fewer syscalls per IO. So even if it doesn't improve disk I/O, it might reduce CPU utilization.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by matheusmoreira on Sunday May 10, 2020 @12:03PM (#23133635)
It could also be nearly zero system calls per I/O operation. The kernel can poll the submission queue for new entries. This eliminates system call overhead at the cost of higher CPU utilization.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by jandrewrogers on Sunday May 10, 2020 @01:22PM (#23134297)
This is true, but for most intentionally optimized storage engines that syscall overhead is below the noise floor in practice, even on NVMe storage. A single core can easily drive gigabytes per second using the old Linux AIO interface.

It appears to primarily be an optimization for storage that was not well-optimized to begin with. It is not obvious that it would make high-performance storage engines faster.

Re:Lord of the io_uring: io_uring tutorial, examples and ref... by loeg on Sunday May 10, 2020 @06:33PM (#23136942)
aio doesn't have facilities for synchronous filesystem metadata operations like open, rename, unlink, etc. If your workload is largely metadata-static, aio is ok. If you need to do even a little filesystem manipulation, io_uring seems like it can provide some benefits.
Re:Lord of the io_uring: io_uring tutorial, examples and ref... by jra_samba on Sunday May 10, 2020 @02:20PM (#23134755)
Samba can optionally use it if you explicitly load the vfs_io_uring module, but it exposed a bug for us (see my comment above). We're fixing it right now.