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/O Multiplexing #5

Open
ibraheemdev opened this issue Nov 21, 2024 · 0 comments
Open

I/O Multiplexing #5

ibraheemdev opened this issue Nov 21, 2024 · 0 comments

Comments

@ibraheemdev
Copy link

I was surprised to find that there is no mention made to the benefit of I/O multiplexing.

A context switch takes around 0.2µs between async tasks, versus 1.7µs between kernel threads. But this advantage goes away if the context switch is due to I/O readiness: both converge to 1.7µs.

The way the benchmarks are set up, from what I could tell, is such that I/O requests are fulfilled sequentially. This means that every call to epoll_wait corresponds to a single readiness event, i.e. a single context switch. This fails to consider scenarios where a large number of concurrent I/O operations allow the cost of the context switch to be amortized, i.e. calls to epoll_wait returning multiple readiness events in exchange for a single context switch.

In other words the cost of an I/O readiness switch may be the same, but an asynchronous server will pay the cost less due to I/O multiplexing. The wording of the quote ("but this advantage goes away") seems to suggest that the perceived benefit of async does not actually manifest in the case of I/O, which is not necessarily true.

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