Align compression levels with Envoy#97
Conversation
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
|
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 |
5fdda3c to
f5d6c5e
Compare
|
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. |
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