Add compressed payload pass-through mode for SR Proxy#9761
Open
banitag1 wants to merge 1 commit intofacebook:masterfrom
Open
Add compressed payload pass-through mode for SR Proxy#9761banitag1 wants to merge 1 commit intofacebook:masterfrom
banitag1 wants to merge 1 commit intofacebook:masterfrom
Conversation
Summary: CONTEXT: Today the SR Proxy always decompresses inbound requests before forwarding to the target service, then the channel layer recompresses on the outbound side. For a pass-through proxy where routing metadata is in Rocket RequestRpcMetadata (not inside the compressed payload), this decompress/ recompress cycle is pure CPU overhead. WHAT: Add a pre-compressed payload pass-through mode that skips decompression and recompression when the target service supports the same compression algorithm. The feature is gated by the sr_proxy_enable_compression_passthrough gflag (default false). Thrift layer (Option E -- RpcOptions hint): - Add preCompressedAlgorithm field to RpcOptions (C++ only, no IDL change) - Add skipCompression param to packWithFds() across all PayloadSerializer strategies (Default, Checksum, CustomCompression) and the facade - In sendThriftRequest(), check RpcOptions and set metadata.compression for the wire format while skipping actual compression in packWithFds() SR Proxy layer: - In processSerializedCompressedRequestWithMetadata(), when the gflag is enabled and the request is compressed, clone the compressed buffer directly into a SerializedRequest without decompressing - Thread preCompressedAlgorithm through the full processing chain (processDecompressedRequest -> finishRequestProcessing -> channelProcessing) - In the getRpcOptions lambda, set preCompressedAlgorithm on RpcOptions so the channel layer knows to skip compression Reviewed By: kaczmarekmhl Differential Revision: D100276926
|
@banitag1 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100276926. |
This file contains hidden or 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
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.
Summary:
CONTEXT: Today the SR Proxy always decompresses inbound requests before
forwarding to the target service, then the channel layer recompresses on the
outbound side. For a pass-through proxy where routing metadata is in Rocket
RequestRpcMetadata (not inside the compressed payload), this decompress/
recompress cycle is pure CPU overhead.
WHAT: Add a pre-compressed payload pass-through mode that skips decompression
and recompression when the target service supports the same compression
algorithm. The feature is gated by the sr_proxy_enable_compression_passthrough
gflag (default false).
Thrift layer (Option E -- RpcOptions hint):
strategies (Default, Checksum, CustomCompression) and the facade
the wire format while skipping actual compression in packWithFds()
SR Proxy layer:
enabled and the request is compressed, clone the compressed buffer directly
into a SerializedRequest without decompressing
(processDecompressedRequest -> finishRequestProcessing -> channelProcessing)
the channel layer knows to skip compression
Reviewed By: kaczmarekmhl
Differential Revision: D100276926