Brotli on the fly v2

I think it’s a mistake to omit Brotli on the fly compression. You should do it. Caddy isn’t even on my list of candidates because it is missing this feature.

Brotli gets the reputation for being a slow algorithm because everyone defaults to using it at level 11, which is very aggressive and takes forever. But that’s the point of level 11, take a long time and get something as small as possible.

Very few people seem to understand full curve available. Even a middle of the road level that most use with gzip, like 4-6, that has relatively reasonable execution times in gzip is pretty slow with brotli. Don’t use these levels for on the fly, the scale is very very different.

Default to and use level 0. It has reasonable compression and excellent speed. It’s generally both faster and better than gzip level 1 in my experience.

1 Like

It is available as a plugin: GitHub - ueffel/caddy-brotli: Brotli compression encoder for Caddy

There isn’t any performant pure-Go implementation, so it doesn’t make sense to have included by default in Caddy.

The one that plugin uses was a direct port of the C code with a tool called c2go which does not produce idiomatic/performant Go code.

If you or anyone else does happen to write a pure-Go brotli implementation, with performance optimizations, then we’d reconsider. But for now, it doesn’t meet the bar of quality we need for it to be included by default in Caddy.

If you can show using Go that the faster levels compress better and are faster than gzip (with less memory overhead), then I’m open to reconsidering it. It’s been a few years after all, maybe things have improved.

This topic was automatically closed after 30 days. New replies are no longer allowed.