mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-22 23:02:32 -04:00
encode: Tweak compression settings (#4215)
* Tweak compression settings zstd: Limit window sizes to 128K to keep memory in control both server and client size. zstd: Write 0 length frames. This may be needed for compatibility. zstd: Create fewer encoders. Small memory improvement. gzip: Allow -2 (Huffman only) and -3 (stateless) compression modes. * Update modules/caddyhttp/encode/zstd/zstd.go Update docs. Co-authored-by: Francis Lavoie <lavofr@gmail.com> Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
@@ -47,7 +47,10 @@ func (Zstd) AcceptEncoding() string { return "zstd" }
|
||||
|
||||
// NewEncoder returns a new gzip writer.
|
||||
func (z Zstd) NewEncoder() encode.Encoder {
|
||||
writer, _ := zstd.NewWriter(nil)
|
||||
// The default of 8MB for the window is
|
||||
// too large for many clients, so we limit
|
||||
// it to 128K to lighten their load.
|
||||
writer, _ := zstd.NewWriter(nil, zstd.WithWindowSize(128<<10), zstd.WithEncoderConcurrency(1), zstd.WithZeroFrames(true))
|
||||
return writer
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user