-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
feat: Allow changing the UDP send/receive buffer sizes #2179
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long story short, I am in favor of this patch.
Increasing the UDP socket send and receive buffer can have a positive performance impact. That said, the additional memory footprint might not be an option for all quinn-udp
users. Thus an opt-in set of functions on UdpSocketState
seems ideal to me.
Long term, once we gathered more experience, we might want to bump the buffer sizes by default.
Worth having the code below use the new functions? Lines 28 to 49 in 434c358
|
Changes look good to me. CI is failing, e.g. on Windows with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have played with this before as well and noticed some interesting behaviour on several platforms. Linux for example will give you however much buffer size it can if you request a really large size and not fail the function.
I am not sure if this is common knowledge around socket APIs :)
Maybe incorporating a log like the one pointed out by @mxinden would be worth it? Maybe not on warn
but on debug? Or we check and return our own error so users can log it themselves?
I am curious to learn about any performance gains you get from this. In my testing, this wasn't a bottleneck but that was also ~6 months ago and I've landed other perf improvements in our codebase since.
I am thinking that I will change the test to check that a "set" operation results in any change of the buffer size in the right direction (increase or decrease). |
I can't figure out why |
Do you know which of the syscalls in quinn/quinn-udp/src/windows.rs Lines 31 to 120 in 434c358
|
Seems to be |
Turns out one needs to bind both sockets on Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget fallback.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you squash your changes into a single commit?
Do we want a quinn-udp version bump so this can be published?
I'll squash Monday. I also want to do a follow-up with methods for reading the buffer sizes. Bump afterwards would be nice. |
Just add a commit with a version bump when you're ready. |
57fcd5f
to
7569329
Compare
I have no idea why (unrelated) tests are failing in CI, they are succeeding locally. |
1f498d2
to
7583047
Compare
7583047
to
d85cd9e
Compare
Also includes getters for the current sizes and a test. Bump version to 0.5.11.
d85cd9e
to
19e0254
Compare
Thanks for merging! Please let me know when you have published 0.5.11. |
|
Add
UdpSocketState::set_send_buffer_size
andUdpSocketState::set_recv_buffer_size
, which allow resizing the respective socket buffers.CC @mxinden