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

An io_uring based Transport Layer (Part III) - Preview Release #2

Open
tkp1n opened this issue Jun 5, 2020 · 5 comments
Open

An io_uring based Transport Layer (Part III) - Preview Release #2

tkp1n opened this issue Jun 5, 2020 · 5 comments
Labels
discussion

Comments

@tkp1n
Copy link
Owner

tkp1n commented Jun 5, 2020

Issue for feedback and discussion around the post An io_uring based Transport Layer (Part III) - Preview Release

@tkp1n tkp1n added the discussion label Jun 5, 2020
@ghost
Copy link

ghost commented Jun 13, 2020

@tkp1n
How can io_uring submission queue size be set when the number of sockets is dynamic? I want to have one receive and one send operation per socket.

@tkp1n
Copy link
Owner Author

tkp1n commented Jun 13, 2020

Good question, @ona993!
I've asked myself the same question when implementing IoUring.Transport and came up with two potential solutions. For both solutions you would want to set the ring size large enough to be able to handle the expected number of concurrent connections/sockets. Even with the best guess, you need an overflow strategy:

  1. Switch to a bigger ring, once you've reached the limits of the current instance. This is similar to how C++ vectors or C# Lists grow when needed.
  2. Maintain a queue-like data structure to store all the submissions you'd like to submit but no longer fit the ring. Make sure to process the items in this queue directly after submitting to the kernel to avoid operations getting stalled for too long in this queue.

The second approach is also how the kernel handles completion queue overflows on kernels that report IORING_FEAT_NODROP.
In IoUring.Transport I've also chosen this second approach as I liked the symmetry to what the kernel is doing.

@jsoneaday
Copy link

jsoneaday commented Jul 18, 2020

This is very cool. Do you know if the windows kernel will get this io capability eventually?

@tkp1n
Copy link
Owner Author

tkp1n commented Jul 20, 2020

This is very cool. Do you know if the windows kernel will get this io capability eventually?

Glad you like it. 😃
On the Windows side of things, we have IOCP allowing us to execute multiple asynchronous IO operations "at once". IOCP is rather old but still surprisingly competitive compared to the Linux alternatives (at least prior to io_uring). I'd be surprised if Windows gets another set of IO APIs any time soon.

@jsoneaday
Copy link

jsoneaday commented Jul 20, 2020

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

No branches or pull requests

2 participants