Skip to content

🔖 Add gzip compression by default with option to opt-out#1310

Merged
Sushisource merged 4 commits into
mainfrom
enable-transport-compression
Jun 5, 2026
Merged

🔖 Add gzip compression by default with option to opt-out#1310
Sushisource merged 4 commits into
mainfrom
enable-transport-compression

Conversation

@Sushisource

Copy link
Copy Markdown
Member

What was changed

Added transport level compression by default

Lang layers will need to expose option to change compression type (should be modeled like enum as we've done here in case we add other compression kinds).

Why?

Be efficient!

Checklist

  1. Closes

  2. How was this tested:
    Existing and new tests

  3. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner June 3, 2026 20:05
@Sushisource Sushisource force-pushed the enable-transport-compression branch from ae45f62 to dc5e780 Compare June 3, 2026 20:06
@mjameswh

mjameswh commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Is the 💥 just a precaution, or are we aware of situations where the default opt-in policy could be problematic?

@Sushisource

Copy link
Copy Markdown
Member Author

Is the 💥 just a precaution, or are we aware of situations where the default opt-in policy could be problematic?

Really just a precaution... maybe we need a different emoji for "requires lang changes but isn't breaking" which is what I really need here.

@Sushisource Sushisource changed the title 💥 Add gzip compression by default with option to opt-out 🔖 Add gzip compression by default with option to opt-out Jun 3, 2026
@Sushisource Sushisource force-pushed the enable-transport-compression branch 2 times, most recently from 8c827e4 to 68e1b4f Compare June 4, 2026 23:29
Comment thread crates/client/src/lib.rs
Comment on lines +593 to +611
// The generated service clients don't share a trait exposing the compression setters, so
// a macro applies the same configuration to each concrete client type.
macro_rules! configure {
($client:expr) => {{
let client = $client.max_decoding_message_size(get_decode_max_size());
match compression {
GrpcCompression::Gzip => client
.send_compressed(CompressionEncoding::Gzip)
.accept_compressed(CompressionEncoding::Gzip),
GrpcCompression::None => client,
}
}};
}

let workflow_svc_client = Box::new(configure!(WorkflowServiceClient::new(svc.clone())));
let operator_svc_client = Box::new(configure!(OperatorServiceClient::new(svc.clone())));
let cloud_svc_client = Box::new(configure!(CloudServiceClient::new(svc.clone())));
let test_svc_client = Box::new(configure!(TestServiceClient::new(svc.clone())));
let health_svc_client = Box::new(configure!(HealthClient::new(svc.clone())));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a trait would be much clearer here, though the macro isn't horrible as macros go.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ends up being uglier since the trait would need to be defined down in the proto crate

Comment on lines +69 to +73
/// Part 2 proves the *outbound request* bytes on the wire are genuinely gzip-compressed. We cannot
/// inspect the bytes of the real (TLS) connection, so this routes through an in-process tonic
/// server that lets us read the raw gRPC frame and confirm the compression flag, gzip magic bytes,
/// size reduction, and that the payload decompresses to the exact same protobuf as the
/// uncompressed request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still enjoying this.

@Sushisource Sushisource enabled auto-merge (squash) June 5, 2026 17:36
Comment thread crates/sdk-core-c-bridge/src/client.rs
Comment thread crates/sdk-core-c-bridge/src/client.rs
Comment thread crates/sdk-core-c-bridge/src/client.rs
Comment thread crates/sdk-core-c-bridge/src/client.rs
@Sushisource Sushisource disabled auto-merge June 5, 2026 17:48
@Sushisource Sushisource enabled auto-merge (squash) June 5, 2026 17:57
@Sushisource Sushisource force-pushed the enable-transport-compression branch from 68e1b4f to 714eb9b Compare June 5, 2026 18:09
@Sushisource Sushisource force-pushed the enable-transport-compression branch from 714eb9b to 6a6c8db Compare June 5, 2026 18:10
@Sushisource Sushisource merged commit f1899d2 into main Jun 5, 2026
21 of 23 checks passed
@Sushisource Sushisource deleted the enable-transport-compression branch June 5, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants