-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
any plans on io_uring support? #401
Comments
I've made basic support, you can find it here: https://github.com/PodnimatelPingvinov/asio/tree/io-uring It has some serious problems (including performance), which are described in readme, that's why I don't want to open PR until they are fixed. |
Some other possibly relevant work: https://github.com/RobertLeahy/AsioUring |
@PodnimatelPingvinov I see this in your repo regarding concurrency: Do I understand correctly that each io_context uses a single SQ/CQ pair? I don't really know io_uring that well, but I'm thinking the io_context <-> SQ/CQ pair relationship may not be the best one. Would maybe make sense to instead, for each io_context, have a SQ/CQ pair per cpu? |
@reddwarf69 FWIW Boost.Asio has plenty of configuration macros such as |
https://github.com/PodnimatelPingvinov/asio/tree/io-uring also says
and
I see IORING_OP_ASYNC_CANCEL was added in Linux 5.6. By the way, it looks Windows is also getting (something very similar, if no identical to) io_uring: https://windows-internals.com/i-o-rings-when-one-i-o-operation-is-not-enough/ |
Yeah, io_uring received a lot of useful functions since its initial version. Asio also changed a lot during this period (i.e. Executors). Those reasons coupled with lack of time made me not feeling ready to rework my original solution atm, sorry. |
There is an initial implementation of io_uring support on the io-uring-1 branch. To use, compile your program with At present, it uses a single CQ/SQ which means that it works best for a single-threaded It seems to be stable with a linux 5.10 kernel. However, under a 5.13 kernel, io_uring seems to behave differently and multi-threaded io_contexts can sometimes result in the OS process table filling up. I have not yet identified the problem there. Single-threaded io_contexts seem ok. Here is a simple single-threaded benchmark. When I test it on linux 5.10 I get the following time with epoll:
and this time when using io_uring:
As you can see, the benchmark completes faster with io_uring. However, this does not include the additional CPU usage associated with io_uring's kernel worker threads, which results in higher overall CPU usage than epoll. (Note: on a 5.13 kernel, this is included in the process's CPU usage.)
|
The
-DASIO_HAS_IO_URING for file-io reactor is not an issue.
with only: #include <asio.hpp> The build error is: In file included from /usr/local/include/asio/detail/impl/scheduler.ipp:28,
from /usr/local/include/asio/detail/scheduler.hpp:238,
from /usr/local/include/asio/system_context.hpp:19,
from /usr/local/include/asio/impl/system_executor.hpp:21,
from /usr/local/include/asio/system_executor.hpp:682,
from /usr/local/include/asio/associated_executor.hpp:24,
from /usr/local/include/asio.hpp:19,
from /root/swc-db/src/cc/include/swcdb/core/comm/asio_wrap.h:33,
from /root/swc-db/src/cc/include/swcdb/core/comm/IoContext.h:11,
from /root/swc-db/src/cc/include/swcdb/core/comm/SerializedServer.h:11,
from /root/swc-db/src/cc/lib/swcdb/core/comm/SerializedServer.cc:8:
/usr/local/include/asio/detail/io_uring_service.hpp:297:3: error: ‘reactor’ does not name a type
297 | reactor& reactor_; while it will compile with: #define ASIO_HAS_IO_URING 1
#define ASIO_DISABLE_EPOLL 1
#include <asio/detail/reactor.hpp>
#include <asio.hpp> |
using asio with io_uring enabled on all of my company production now. no issuses found so far other than the udp endpoint reference missing bug #965. may thanks for the hard work! |
Just an observation that running the benchmark under WSL yields better results for epoll than uring... epoll:
uring:
details:
|
IOCP is supported, the linux new io_uring API is more like IOCP than epoll. any plans on supporting this new and really fast API? io_uring supports eventfd, socket, and regular files.
The text was updated successfully, but these errors were encountered: