-
Notifications
You must be signed in to change notification settings - Fork 840
Add Zstandard compression support and update tests #12201
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
base: master
Are you sure you want to change the base?
Changes from 16 commits
b22cbee
facf384
eda7c29
21e27bf
2a2acf6
536f920
9a5432d
ab79771
d94321d
729fbac
4bf0c10
17e3c6b
91029c5
c7389c5
4608bad
03e647a
079b002
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -192,12 +192,59 @@ supported-algorithms | |||||||
|
||||||||
Provides the compression algorithms that are supported, a comma separate list | ||||||||
of values. This will allow |TS| to selectively support ``gzip``, ``deflate``, | ||||||||
and brotli (``br``) compression. The default is ``gzip``. Multiple algorithms can | ||||||||
be selected using ',' delimiter, for instance, ``supported-algorithms | ||||||||
deflate,gzip,br``. Note that this list must **not** contain any white-spaces! | ||||||||
brotli (``br``), and zstd (``zstd``) compression. The default is ``gzip``. | ||||||||
Multiple algorithms can be selected using ',' delimiter, for instance, | ||||||||
``supported-algorithms deflate,gzip,br,zstd``. Note that this list must **not** | ||||||||
contain any white-spaces! | ||||||||
Comment on lines
+207
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably don't want this in the docs. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which part should we remove, is it the original sentence noting whitespace?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha, I actuallly didn't realize that was in there originally. Good point. Yes, let's remove it if you don't mind. It's not very user-friendly to contain a dev-only comment in the published docs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it for plugin users? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is yeah, we could opt to trim the whitespace so that it doesn't matter if they included it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trimming the whitespace would be nice, but I'd like to see the change on a separate PR. One change on one PR. @bneradt I'm really not sure what makes you think this is not very user-friendly. It looks like an important note for users with a configuration example. |
||||||||
|
||||||||
============== ================================================================= | ||||||||
Algorithm Description | ||||||||
============== ================================================================= | ||||||||
gzip Standard gzip compression (default, widely supported) | ||||||||
deflate Deflate compression (RFC 1951) | ||||||||
br Brotli compression (modern, efficient) | ||||||||
zstd Zstandard compression (fast, high compression ratio) | ||||||||
JosiahWI marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
============== ================================================================= | ||||||||
|
||||||||
Note that if :ts:cv:`proxy.config.http.normalize_ae` is ``1``, only gzip will | ||||||||
be considered, and if it is ``2``, only br or gzip will be considered. | ||||||||
be considered, if it is ``2``, only br or gzip will be considered, if it is ``4``, | ||||||||
only zstd, br, or gzip will be considered, and if it is ``5``, all combinations | ||||||||
of zstd, br, and gzip will be considered. | ||||||||
|
||||||||
gzip-compression-level | ||||||||
----------------------- | ||||||||
|
||||||||
Sets the compression level for gzip compression. Valid values are 1-9, where | ||||||||
1 is fastest compression (lowest compression ratio) and 9 is slowest compression | ||||||||
(highest compression ratio). The default is 6, which provides a good balance | ||||||||
between compression speed and ratio. | ||||||||
|
||||||||
brotli-compression-level | ||||||||
------------------------- | ||||||||
|
||||||||
Sets the compression level for Brotli compression. Valid values are 0-11, where | ||||||||
0 is fastest compression (lowest compression ratio) and 11 is slowest compression | ||||||||
(highest compression ratio). The default is 6, which provides a good balance | ||||||||
between compression speed and ratio. | ||||||||
|
||||||||
brotli-lgwin | ||||||||
------------ | ||||||||
|
||||||||
Sets the window size for Brotli compression. Valid values are 10-24, where | ||||||||
larger values provide better compression but use more memory. The default is 16. | ||||||||
This parameter controls the sliding window size used during compression: | ||||||||
|
||||||||
- 10: 1KB window (fastest, least memory) | ||||||||
- 16: 64KB window (default, good balance) | ||||||||
- 24: 16MB window (slowest, most memory, best compression) | ||||||||
|
||||||||
zstd-compression-level | ||||||||
---------------------- | ||||||||
|
||||||||
Sets the compression level for Zstandard compression. Valid values are 1-22, where | ||||||||
1 is fastest compression (lowest compression ratio) and 22 is slowest compression | ||||||||
(highest compression ratio). The default is 12, which provides an excellent | ||||||||
balance between compression speed and ratio for web content. | ||||||||
|
||||||||
Examples | ||||||||
======== | ||||||||
|
@@ -214,6 +261,10 @@ might create a configuration with the following options:: | |||||||
compressible-status-code 200, 206 | ||||||||
minimum-content-length 860 | ||||||||
flush false | ||||||||
gzip-compression-level 6 | ||||||||
brotli-compression-level 6 | ||||||||
brotli-lgwin 16 | ||||||||
zstd-compression-level 12 | ||||||||
|
||||||||
# Now set a configuration for www.example.com | ||||||||
[www.example.com] | ||||||||
|
@@ -231,13 +282,37 @@ might create a configuration with the following options:: | |||||||
flush true | ||||||||
supported-algorithms gzip,deflate | ||||||||
|
||||||||
# Supports brotli compression | ||||||||
# Supports brotli compression with custom settings | ||||||||
[brotli.compress.com] | ||||||||
enabled true | ||||||||
compressible-content-type text/* | ||||||||
compressible-content-type application/json | ||||||||
flush true | ||||||||
supported-algorithms br,gzip | ||||||||
brotli-compression-level 8 | ||||||||
brotli-lgwin 20 | ||||||||
|
||||||||
# Supports zstd compression for high efficiency | ||||||||
[zstd.compress.com] | ||||||||
enabled true | ||||||||
compressible-content-type text/* | ||||||||
compressible-content-type application/json | ||||||||
compressible-content-type application/javascript | ||||||||
flush true | ||||||||
supported-algorithms zstd,gzip | ||||||||
zstd-compression-level 15 | ||||||||
|
||||||||
# Supports all compression algorithms with optimized settings | ||||||||
[all.compress.com] | ||||||||
enabled true | ||||||||
compressible-content-type text/* | ||||||||
compressible-content-type application/json | ||||||||
flush true | ||||||||
supported-algorithms zstd,br,gzip,deflate | ||||||||
gzip-compression-level 7 | ||||||||
brotli-compression-level 9 | ||||||||
brotli-lgwin 18 | ||||||||
zstd-compression-level 10 | ||||||||
|
||||||||
# This origin does it all | ||||||||
[bar.example.com] | ||||||||
|
Uh oh!
There was an error while loading. Please reload this page.