Skip to content
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

I don't think there is any mention to multi-threading #4

Open
reddwarf69 opened this issue Jun 21, 2020 · 0 comments
Open

I don't think there is any mention to multi-threading #4

reddwarf69 opened this issue Jun 21, 2020 · 0 comments

Comments

@reddwarf69
Copy link
Contributor

reddwarf69 commented Jun 21, 2020

I don't think there is any documentation regarding the use of multiple threads and load balancing.
Windows IOCP documentation is very explicit about how it interacts with multiple threads. https://man7.org/linux/man-pages/man7/epoll.7.html has If multiple threads (or processes, if child processes have inherited the epoll file descriptor across fork(2)) are blocked in epoll_wait(2) waiting on the same epoll file descriptor and a file descriptor in the interest list that is marked for edge-triggered (EPOLLET) notification becomes ready, just one of the threads (or processes) is awoken from epoll_wait(2). This provides a useful optimization for avoiding "thundering herd" wake-ups in some scenarios.. But I don't think there is anything similar about io_uring.

When somebody tried to implement an io_uring backend for ASIO (which may well be the standard networking API in C++23) this is what he had to say (https://github.com/PodnimatelPingvinov/asio/tree/io-uring#concurrency): you can't concurrently make ... 2 reads from CQ. You can concurrently wait for completions in CQ (using io_uring_wait_cqe in multiple threads), but in such situation all waiting threads will be woken up when completion event become available. This is not what you want, that's why only one thread should wait for completions in the same time. Therefore I use io_uring in the same manner as reactor works, via existing scheduler. and then goes to complain about the resulting performance. He basically takes the data from that nice shared memory CQ and copies it into an user-space queue. I expect the basis of his implementation to be wrong. But I can't really tell him or a great alternative.

Basically io_uring looks great avoiding system calls and data copying, but... who takes care of the load balancing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant