Skip to content

Add compressed payload pass-through mode for SR Proxy#9761

Open
banitag1 wants to merge 1 commit intofacebook:masterfrom
banitag1:export-D100276926
Open

Add compressed payload pass-through mode for SR Proxy#9761
banitag1 wants to merge 1 commit intofacebook:masterfrom
banitag1:export-D100276926

Conversation

@banitag1
Copy link
Copy Markdown
Contributor

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

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
@meta-cla meta-cla bot added the CLA Signed label Apr 13, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 13, 2026

@banitag1 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100276926.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant