summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/encode/zstd/zstd.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/encode/zstd/zstd.go')
-rw-r--r--modules/caddyhttp/encode/zstd/zstd.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/caddyhttp/encode/zstd/zstd.go b/modules/caddyhttp/encode/zstd/zstd.go
index 5182fc4..d2a638c 100644
--- a/modules/caddyhttp/encode/zstd/zstd.go
+++ b/modules/caddyhttp/encode/zstd/zstd.go
@@ -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
}