-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implements a dual sender Zerocopy strategy for QUIC V1 and VReverso #5
Open
frochet
wants to merge
17
commits into
protocol_reverso
Choose a base branch
from
sender_zc
base: protocol_reverso
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A BufFactory can override the generic buffer generation method with a custom method, eg. getting a buffer from a pool buffer.
Instead of copying data into internal buffers, the new methods enable queing raw buffers directly into the quiche send stream, this improves cache-locality and reduces cpu usage.
…on's hidden copy to perferom packet assembly
…on's hidden copy to perferom packet assembly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds a dual zerocopy sending optimization capability to both QUIC V1 and QUIC VReverso. There are two optimizations which can be used independently, with pros and cons.
The first implementation integrates quiche's opened PR cloudflare/quiche#1673 to quiceh.
This code optimizes out a copy happening in the
stream_send()
API call. To benefit from it, the Application has to use the new functionstream_send_zc
With
F
implementing the traitBufFactory
, andBuf
implementingBufSplit
:The second optimization uses BoringSSL's scatter encryption to assemble a packet containing Stream data and QUIC control frames without copying the Stream data. The code behaves slightly differently depending on whether this is a QUIC V1 connection or QUIC VReverso connection.
On QUIC V1:
The control information is written inside the destination buffer, with the Stream header frame being the last control. The stream data is the extra_in. The scatter encryption encrypts and glue together control and data. The stream Frame is then always the last frame of the packet.
On QUIC VReverso:
The control information is written inside the destination buffer, at its expected offset. The first bytes of the control information holds the reversed Stream frame header, also called data footer in VReverso. The in_buf data is a pointer to the Stream Frame data. The encryption is a partial aliasing encrypting the stream Frame data into the destination with in-place encryption of the controls as an extra_in. The result holds a packet for which the reversed stream frame is always the first frame, which is a necessary condition to have contiguous zero-copy on the receiver in VReverso.
For both QUIC V1 and QUIC VReverso, this capability is controlled by a
Config
option, and is global to all streams.Enabling this option performs scatter encryption without distinction to the usage of
stream_send()
orstream_send_zc()
.This option has however the consequence to make the packet trace different, and more dependent on Application behavior. For example, assume we send two images each of 1500 bytes within the same stream using
stream_send_zc()
. If this option is disabled, the network will see 3 packets flying (two large ones, and a last one the size of the remaining bytes). If this option is enabled, the network will see 4 QUIC packets flying, 2 for each image. 1 large, 1 small, 1 large, 1 small.The demonstration HTTP/3 client server supports now sending HTTP/3 response in zero-copy, internally using
stream_send_zc()
. An option is further added to the CLI to enable the scatter encryption using flag--enable-hidden-copy
We recommend enabling this option typically if large application objects are sent, and to avoid it in case many small independent objects are flushed into the same stream. The impact such an optimization may have on website fingerprinting remains to be studied.