-
Notifications
You must be signed in to change notification settings - Fork 833
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?
Conversation
[approve ci] |
@masaori335 do you know which files I need to modify to install zstd on the osx used in the Jenkins job? |
We need to ask @ezelkow1 to install the package in the osx env, I guess. However, this PR has |
0167bf5
to
74cd8b5
Compare
thank you, _F was a mistake, it was meant to be _H |
308032c
to
c598282
Compare
Looks like all the FreeBSD machines for CI are offline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really appreciate it if you can please add some documentation to the changes.
Thanks.
Hi! This doesn't compile for me. I added a line to
Please include this patch in your PR to enable the ZSTD code. Thanks!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please patch ink_config.h
and resolve compiler issues.
4b8603e
to
72c0dbf
Compare
[approve ci autest] |
@bryancall i think this is ready to review now 🙏 |
6a9110b
to
6c3f2ca
Compare
This patch adds full support for the zstd (Zstandard) compression algorithm throughout Apache Traffic Server, including build system integration, compression plugin support, Accept-Encoding header normalization, and comprehensive test coverage. Build system and dependencies: - Add CMake support for finding zstd library with new Findzstd.cmake - Update Docker build files to include libzstd-dev package - Add TS_HAS_ZSTD feature flag for conditional compilation Core compression support: - Extend compress plugin to support zstd compression alongside gzip and brotli - Add zstd stream handling structures and functions - Update compression configuration to include zstd in supported algorithms list - Add zstd compression type constant and related infrastructure Accept-Encoding header normalization: - Extend proxy.config.http.normalize_ae configuration to support values 4 and 5 for zstd normalization - Add zstd support to header normalization logic with proper priority handling (zstd > br > gzip) - Update HTTP transaction cache matching to handle zstd encoding - Add zstd token to header parsing infrastructure API and infrastructure: - Add TS_HTTP_VALUE_ZSTD and TS_HTTP_LEN_ZSTD constants - Update MIME field handling to recognize zstd encoding - Add zstd support to traffic_layout feature detection Test coverage: - Expand compress plugin tests to cover zstd compression scenarios - Add zstd test cases to Accept-Encoding normalization tests - Update golden files to include zstd compression test results - Add new compress3.config for zstd-specific plugin configuration - Test all combinations of zstd, br, and gzip in various scenarios The implementation follows RFC 8878 standards for zstd compression and maintains backward compatibility with existing gzip and brotli compression functionality. All tests pass and the feature is properly integrated with the existing caching and content negotiation mechanisms.
This patch fixes the Accept-Encoding quality calculation logic in the HTTP transaction cache and updates test files to reflect the corrected behavior, removing workarounds for previously broken cache matching. Cache quality calculation improvements: - Replace multiplicative quality combining with minimum quality selection for multiple content encodings - Simplify wildcard matching to return quality directly - Remove gzip-specific fallback logic that bypassed normal quality calculation and caused inconsistent cache behavior Test updates for corrected behavior: - Remove NOTICE comments describing broken cache matching behavior - Update test expectations to match correct cache responses instead of workaround responses - Fix cache hit/miss expectations for multi-encoding scenarios - Add missing Content-Encoding headers in server responses - Update response identifiers to match the actual cached alternates Specific test corrections: - "br, compress, gzip" now correctly matches "Br-Gzip-Accept-Encoding" instead of falling back to "Gzip-Accept-Encoding" - "zstd, compress, gzip" now correctly matches "Zstd-Gzip-Accept-Encoding" instead of falling back to "Gzip-Accept-Encoding" - "zstd, gzip;q=0.8" now correctly matches "Zstd-Gzip-Accept-Encoding" instead of falling back to "Gzip-Accept-Encoding" - Individual encoding requests now create proper cache alternates instead of incorrectly matching empty encoding alternates The previous multiplicative quality calculation (q_a * q_b) was causing unexpectedly low quality scores and incorrect cache alternate selection. The new minimum quality approach ensures that multi-encoding responses are properly cached and matched according to HTTP content negotiation standards. All test cases now pass without workarounds and demonstrate correct cache behavior for all compression algorithms (gzip, brotli, zstd) across various Accept-Encoding
107214f
to
1a4fc19
Compare
- Add support for configurable compression levels per host: * gzip-compression-level (1-9, default 6) * brotli-compression-level (0-11, default 6) * brotli-lgwin (10-24, default 16) * zstd-compression-level (1-22, default 12) This enables fine-tuning compression performance vs. speed trade-offs on a per-host basis
This pull request adds full support for the zstd (Zstandard) compression algorithm throughout Apache Traffic Server, including build system integration, compression plugin support, Accept-Encoding header normalization, and test coverage.
Key Features
Build system and dependencies:
Findzstd.cmake
libzstd-dev
packageTS_HAS_ZSTD
feature flag for conditional compilationCore compression support:
Accept-Encoding header normalization:
proxy.config.http.normalize_ae
configuration to support values 4 and 5 for zstd normalizationAPI and infrastructure:
TS_HTTP_VALUE_ZSTD
andTS_HTTP_LEN_ZSTD
constantsImproved cache matching:
Test Coverage
compress3.config
for zstd-specific plugin configurationStandards Compliance
The implementation follows RFC 8878 standards for zstd compression and maintains backward compatibility with existing gzip and brotli compression functionality. All tests pass and the feature is properly integrated with existing caching and content negotiation mechanisms.
Configuration
New normalization modes:
proxy.config.http.normalize_ae = 4
: Prioritize zstd, fallback to br then gzipproxy.config.http.normalize_ae = 5
: Support all combinations of zstd, br, and gzipBenefits