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

Discussion: performance about reading/writing a socket #69

Closed
CarterLi opened this issue Feb 7, 2020 · 0 comments
Closed

Discussion: performance about reading/writing a socket #69

CarterLi opened this issue Feb 7, 2020 · 0 comments

Comments

@CarterLi
Copy link
Contributor

CarterLi commented Feb 7, 2020

When benchmarking an echo server written with io-uring, I found adding a poll_add sqe before readv/recvmsg could result in about 30% performance boost:

https://github.com/CarterLi/io_uring-echo-server/blob/switch/io_uring_echo_server.c#L14

131729 request/sec VS 98694 request/sec using rust_echo_bench.

That was unexpected. AFAIK readv/recvmsg is async operation itself, adding a poll_add sqe won't help but result in extra context switch ( because it will awake io_uring_enter ).

After some investigation, I found program without poll_add will create lots of kernel processes called io_wqe_worker. But program with poll_add won't.

image

Don't know how poll_add works, but it seems that poll_add has much lower cost then async read. Is it expected? And maybe a silly question, could we implement async read as poll-add and nonblocking read?

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