Class CompressionSettings.Zstandard

java.lang.Object
com.iizix.jetty.CompressionSettings.Zstandard
Enclosing class:
CompressionSettings

public static final class CompressionSettings.Zstandard extends Object
Default settings for the Zstandard compression algorithm (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.

  • Field Details

    • COMPRESSION_LEVEL

      public static volatile int COMPRESSION_LEVEL
      Zstandard compression level.

      Possible values:

      • -7..-1 -- "fast" modes (negative levels), trade ratio for speed
      • 1..3 -- fast, typical for low-latency HTTP (level 3 is the zstd default)
      • 4..9 -- balanced
      • 10..19 -- slower, better ratio
      • 20..22 -- "ultra" modes, very slow, marginal additional ratio

      Default: 22 (maximum compression).

    • BUFFER_SIZE

      public static volatile int BUFFER_SIZE
      Encoder buffer size in bytes.

      Possible values: any positive int; practical range 8192..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).