Replies: 2 comments 2 replies
-
I think CQ ring resizing could be implemented. I agree it's a bit of an issue, as you would otherwise always need to size the CQ ring for the worst case scenario. That could be wasteful. The SQ size is easier to deal with, as it only really controls the max batch that can get submitted in one go. That's more constant, and also less critical. And overflowing CQ ring is not ideal. Let me take a look at it... |
Beta Was this translation helpful? Give feedback.
-
I took a look, here are the kernel patches to do it: https://git.kernel.dk/cgit/linux/log/?h=io_uring-ring-resize and here is the liburing side of it: https://git.kernel.dk/cgit/liburing/log/?h=resize-rings Totally untested, but I'll write some test cases. How to use it is in the liburing commit, it should be pretty straight forward. It'll retain state of the SQ and CQ ring, so unconsumed entries will be propagated to the new ring state before the resize call returns. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm writing a TCP Socket client using io_uring and I'd like to know if my approach is right/if I should switch to liburing.
In short, I have a class that represents a TCP socket.
When a client is created for the first time, I initialize a io_uring and start a thread that waits for at least one new event using the IORING_ENTER_GETEVENTS and resolves the appropriate callbacks using the user_data field as an identifier.
Then when the connect, send or read methods are called in the TCP socket client, I create a new async operation and notify the kernel.
Everything works as expected, but I have a problem: the queue size.
By default, I use a queue size of 1024, but if I start concurrently more clients than that, the queue overflows.
I could wait for the queue to free up using a lock system, but I feel like that's not the best solution.
As far as I can tell, there is no way to resize the queue(which makes sense), but then am I supposed to use a larger queue and a lock system and let the user configure the size so he doesn't get bottlenecked? Is there a built-in solution in liburing that I didn't see?
Thanks in advance for any help
Beta Was this translation helpful? Give feedback.
All reactions