feat: Allow changing the UDP send/receive buffer sizes#2179
feat: Allow changing the UDP send/receive buffer sizes#2179djc merged 1 commit intoquinn-rs:mainfrom
Conversation
mxinden
left a comment
There was a problem hiding this comment.
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.
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. |
djc
left a comment
There was a problem hiding this comment.
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_sizeandUdpSocketState::set_recv_buffer_size, which allow resizing the respective socket buffers.CC @mxinden