Class CompressionSettings.Zstandard
- Enclosing class:
CompressionSettings
ZstandardCompression).Backed by the zstd-jni native library (bundled inside the jetty-compression-zstandard jar for the major platforms). Supported by Firefox 126+ (2024-05) and Chrome 123+ (2024-03).
Zstandard is generally faster than brotli at comparable compression ratios, and uniquely supports negative "fast" levels for ultra-low-CPU encoding. Defaults below favour ratio.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intEncoder buffer size in bytes.static intZstandard compression level.Method Summary
Field Details
COMPRESSION_LEVEL
public static volatile int COMPRESSION_LEVELZstandard compression level.Possible values are
1through19. The zstd library itself also has "fast" modes-7..-1and "ultra" modes20..22, but the Jetty wrapper exposes neither and raisesIllegalArgumentExceptionfor anything outside1..19, which disables zstandard for the whole server. Reference points:1..3-- fast, typical for low-latency HTTP (level 3 is the zstd default)4..9-- balanced10..19-- slower, better ratio
Default:
19(maximum usable compression -- the same value asWSHelper.Type.ZSTANDARD.compressionLevel, and NOT the zstd maximum of 22, which the Jetty wrapper cannot take).BUFFER_SIZE
public static volatile int BUFFER_SIZEEncoder buffer size in bytes.Possible values: any positive
int; practical range8192..524288. Zstandard benefits from larger buffers than gzip or brotli, particularly at high compression levels where its window can extend into the megabyte range.Default:
65536(64 KiB).