-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] Support async I/O with uring / liburing #12650
Comments
/cc @tmds |
@benaadams Looks similar to Windows RIO? |
@omariom In spirit it definitely is, but there are a few key differences:
|
Is also one of the options of RIO. Does have a flavour of completion ports e.g. async with fast-path sync completion if data is already ready, rather than having to do callback. Extending the registration to all IO is good; especially with advancements in throughput e.g. NVMe. Definitely interesting! |
In apps consisting of microservices |
(I'm the one who was playing with io_uring in Node.js/libuv, mentioned in the OP; sharing some notes here.) io_uring is more like Windows' "overlapped IO" with IOCP than RIO in terms of usability with files.
(Referring to kernel-side polling of the submission queue) Note that this requires root, torvalds/linux@3ec482d#diff-a196e54ec8b5398427f9df3d2b074478.
io_uring still has fixed-sized SQs and CQs. It's immediately safe to use a SQ slot once io_uring_enter/submit returns (before the kernel is done processing it). There's a tiny bit of info on what happens with full CQs in http://git.kernel.dk/cgit/liburing/commit/?id=76b61ebf1bd17d3a31c3bf2d8236b9bd50d0f9a8 but I'm still uncertain what happens if you submit more events and e.g. never drain the CQ.
but I can't find the "later" part :). I assume the CQE just gets overwritten. |
And here's the answer on CQ overflow: https://twitter.com/axboe/status/1126203058071826432
|
Is there some info on how you use this with sockets? In particular how to deal with blocking calls. |
To answer my own question. You can use io_uring like epoll in one-shot mode. There is a command to add poll for a fd, and there is a command to cancel an on-going poll. |
When looking into io_uring we also need to consider what operations are privileged, and what kernel resources are needed. To have wide applicability, it should work in a Kubernetes container deployment.
If you're writing to disk, you can control this. |
It does this smarter now and won't drop anything. Since 5.5, I believe. Cc: @axboe |
With the recent |
For reference, looks like other web-frameworks are adopting this. LibUV which powers nodeJs just picked up this support. |
It seems that Linux finally has a good story when it comes to async I/O: io_uring
While this is only released as part of Kernel 5.1, it definitely looks like a game changer when it comes to async I/O perf...
There's no point in going into what io_uring brings to the table in this issue, as it should be pretty clear from the linked PDF document, it is worth while to mention that this allows for some super high-perf scenarios by using advanced features such as:
O_DIRECT
) to avoid expensive page-table manipulation on the kernel side (!)Some initial tests for File I/O from nodejs point to very substantial latency reductions (I'm "reprinting" the latency numbers from the linked comment):
I think that supporting this in CoreCLR can lead to substantial improvemnt of async I/O in Linux...
At the same time, its not clear to me how/if/when CoreCLR should adopt this and at what abstraction level...
The text was updated successfully, but these errors were encountered: