-
Notifications
You must be signed in to change notification settings - Fork 120
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
Driver: Split receive into its own feature #141
Conversation
Adds the "receive" feature, which is disabled by default. When this is disabled, the UDP receive task is not compiled and not run, and as an optimisation the UDP receive buffer size is set to 0. All related events are also removed. Closes serenity-rs#131.
I know it would probably be a bit of a hassle, but performance could be further improved by getting rid of the udp_tx task entirely when receive is disabled, eg: GnomedDev@d4b5d87 |
I originally had a slight ideological issue with "putting a UDP send in sync code", but thinking on the packet cycle structure this is probably fine. If you step into the cycle a bit, you get The current UDP Tx design has some benefits (never blocks sender, unbounded), but costs a The only thing about the patch you link is that it also drops sending UDP keepalives -- I suppose you can get away without them if you know you're running on dedicated infra, but they're generally there to make sure that NAT entries don't vanish during silent periods for folks running { songbird, Discord itself } from a home machine. I could just stick them after packet sends to keep the sleep logic simple. |
Quick test on "receive" suggests that a non-blocking |
Adds the "receive" feature, which is disabled by default. When this is disabled, the UDP receive task is not compiled and not run, and as an optimisation the UDP receive buffer size is set to 0. All related events are also removed. This also removes the UDP Tx task, and moves packet and keepalive sends back into the mixer thread. This allows us to entirely remove channels and various allocations between the mixer and an async task created only for sending data (i.e., fewer memcopies). If "receive" is enabled, UDP sends are now non-blocking due to technical constraints -- failure to send is non-fatal, but *will* drop affected packets. Given that blocking on a UDP send indicates that the OS cannot clear send buffers fast enough, this should alleviate OS load. Closes serenity-rs#131.
Adds the "receive" feature, which is disabled by default. When this is disabled, the UDP receive task is not compiled and not run, and as an optimisation the UDP receive buffer size is set to 0. All related events are also removed.
Closes #131.