opt(s2n-quic-dc): skip epoll registration in happy path #2754
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release Summary:
Resolved issues:
n/a
Description of changes:
Currently, dcQUIC streams over TCP will be accepted, be registered with epoll, attempt reading (usually fails), in <1ms the first data packet arrives and we succeed reading, deregister the socket, and then hand off the stream to the application for further reading.
We'd like to avoid the epoll registration as it uses extra CPU (even if latency impact is minimal) so this patch uses the Linux-only TCP_DEFER_ACCEPT to only accept sockets with data already available. That's combined with lazy registration of sockets with Tokio's epoll by only doing so if we get WouldBlock after attempting a read or write. The net effect is that based on flamegraphs epoll registration in the acceptor isn't visible anymore.
The net effect is a 8.8% (relative) drop in overall CPU usage in one of our internal benchmarks which exercises short streams over loopback, bringing CPU usage in the acceptor from 23% of the workload to 18%.
Call-outs:
n/a
Testing:
The new code is semantically a no-op and is exercised by existing tests (see the updated timeout/sleep).
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.