-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call for encode br
support for brotli
compression
#5194
Comments
encode brotli
supportencode br
support for brotli
compression
Glad you like Caddy! Unfortunately, performance of compressing brotli on-the-fly is unacceptable with current implementations. (My understanding is that the brotli format itself is more expensive to encode than decode, so it's possible that it may never be within tolerances.) If it can be made fast enough (with pure Go and/or assembly) then we are open to doing it. Kind of a duplicate of #3704 Related: #3692 We encourage clients to support Zstandard for more modern on-the-fly compression. |
Hi @mholt I totally see your point of Brotli being too slow for on the fly compression, but what about case where Caddy request is being cached? Not having Brotli at all is quite limiting. I'm serving content from 3rd party softwre that does not give me option to precompress assets. Caddy would be perfect place to handle it, and use caching down the pipe. Thanks |
There exists a plugin to provide brotli support. You can use that. But because of the performance concerns, it does not make sense to include in Caddy's standard distribution because users will use it without understanding the performance implications then complain to us when they have very high CPU usage. So we're careful about what we include by default. |
oh good to hear, thanks! |
If you can find us an optimized implementation in Go, we will happily use it. But current implementations grind servers to a halt. Brotli is just hard to encode efficiently. |
Hi, why can you not call from caddy a c library which is doing this faster? |
The top reasons are:
Cockroach Labs have a good blogpost about the overhead of using CGO: The cost and complexity of Cgo |
Also memory safety. No good if a file can cause a C library to pop out of its memory bounds. |
For the record, I created a module that relies on the official C implementation (and the Google Go module): https://github.com/dunglas/caddy-cbrotli |
Is this implementation fast enough to run it for dynamic created content or is it only good for static files? |
@sowinski according to my tests it is good enough dynamic content. |
would be nice if this feature would fine the way to the next caddy version |
Kevin's plugin still uses C (CGO). There's near zero chance we're admitting C dependency into Caddy. Plugins can be developed and built for users who desire to accept the risk and complexity of having C in the stack. |
I found
brotli
is more widely used/supported on mobile browsers thangzip
these days.I think, it's about ~23.33%(96.55%-73.22%) delta that is announced.
BTW, thanks a ton for your great
Caddy
, I really like it.The text was updated successfully, but these errors were encountered: