Skip to content

yuweizzz/compression-dictionary-transport

Repository files navigation

compression-dictionary-transport

A simple OpenResty implementation of HTTP compression dictionary transport and related tools.

Tools

brotli_dictionary_generator: A dictionary generator provided by Brotli, used to train the dictionary.

zstd_dictionary_converter: Converts the Zstandard-formatted dictionary to a raw dictionary.

Openresty implementation

Depends on Zstandard; include zstd shared library and zstd-ffi.

Dynamic compression

Dynamic compression requires training the dictionary first, and all subsequent content will be compressed using the same dictionary.

To train the dictionary:

# use zstd to train dictionary
zstd --train content/* -o zstd_dict.dat
zstd_dictionary_converter -i zstd_dict.dat -o dict.dat

# use brotli_dictionary_generator
brotli_dictionary_generator dict.dat content/*

Change the dict_location in the OpenResty configuration.

Static compression

Static compression will use the response as a dictionary. It is suitable for resources that change little between different versions.

There is no need to train the dictionary first.

Ref

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published