Skip to content

Align compression levels with Envoy#97

Merged
anuraaga merged 2 commits into
connectrpc:mainfrom
anuraaga:gzip-level-6
Jan 27, 2026
Merged

Align compression levels with Envoy#97
anuraaga merged 2 commits into
connectrpc:mainfrom
anuraaga:gzip-level-6

Conversation

@anuraaga

@anuraaga anuraaga commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Currently, gzip compression, our default, uses Python's default of level 9 which is for long term storage like OS packages and not good for network servers.

I wanted to align with some standard for defaults, and went with Envoy where brotli=3, gzip=6, zstd=3

For reference, connect-go uses the defaults for the Go libraries for all compressions (zstd / brotli are within the conformance runner), which are level=6 for gzip and brotli, and default (level 3) for zstd.

As gzip is used by default, this is probably closer to a bug than performance enhancement

#96

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
@anuraaga anuraaga requested a review from a team January 26, 2026 01:09
@Zaczero

Zaczero commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

It's not a full review but just reading the PR body. brotli-6 is about 2x slower than gzip-6 and CDNs like Cloudflare default to brotli-4 which seems to match the compression time.

https://dev.to/coolblue/improving-website-performance-with-brotli-5h70

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
@anuraaga anuraaga changed the title Align compression levels with connect-go Align compression levels with Envoy Jan 26, 2026
@anuraaga

Copy link
Copy Markdown
Collaborator Author

Thanks @Zaczero for bringing that up - I found https://blog.cloudflare.com/results-experimenting-brotli/ for more background and it's interesting that they default to gzip=8. I interpret this as their gzip default coming from a day of mostly static content and brotli from more dynamic content.

For the defaults, I'd like to pick a reference point and just go with it rather than try to introduce opinions. I remembered Envoy supports all three, and its use case is similar to connect, often serving APIs. So I went with it. But given all the different defaults out there, it looks like going forward it will indeed be important to provided configurable compression to opt-out of our defaults.

@anuraaga anuraaga merged commit 35b36fd into connectrpc:main Jan 27, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants