Iouring - A modern asynchronous I/O interface for Linux
The Linux kernel has had asynchronous I/O since version 2.5, but it was seen as difficult to use and inefficient.
io_uring (previously known as aioring) is a Linux kernel system call interface for storage device asynchronous I/O operations addressing performance issues with similar interfaces provided by functions like read()/write() or aio_read()/aio_write() etc. for operations on data accessed by file descriptors.
It was primarily developed by Jens Axboe at Facebook.
Internally it works by creating two buffers dubbed as “queue rings” (circular buffers) for storage of submission and completion of I/O requests (for storage devices, submission queue (SQ) and completion queue (CQ) respectively). Keeping these buffers shared between the kernel and application helps to boost the I/O performance by eliminating the need to issue extra and expensive system calls to copy these buffers between the two.According to the io_uring design paper, the SQ buffer is writable only by consumer application, and CQ - by kernel.
The API provided by liburing library for userspace (applications) can be used to interact with the kernel interface more easily.
Both kernel interface and library were adapted in Linux 5.1 kernel version.
Credit to: Donald Hunter (A visual representation of the io_uring submission and completion queues)
Reference
- Why you should use io_uring for network I/O
- https://dl.acm.org/doi/pdf/10.1145/3534056.3534945
- https://kernel-recipes.org/en/2019/talks/faster-io-through-io_uring/
- https://en.wikipedia.org/wiki/Io_uring
- https://kernel.dk/io_uring.pdf
- https://developers.mattermost.com/blog/hands-on-iouring-go/
- https://lwn.net/Articles/810414/
- https://lwn.net/Articles/776703/