···1212* `EXTERNAL_BASE` - The hostname of the feed generator.
1313* `DATABASE_URL` - The URL of the database to use.
1414* `JETSTREAM_HOSTNAME` - The hostname of the JetStream server to consume events from.
1515-* `ZSTD_DICTIONARY` - The path to the ZSTD dictionary to use.
1515+* `COMPRESSION` - Use zstd compression. Default `false`.
1616+* `ZSTD_DICTIONARY` - The path to the ZSTD dictionary to use. Required when compression is enabled.
1617* `CONSUMER_TASK_ENABLE` - Whether or not to enable the consumer tasks. Default `true`.
1718* `VMC_TASK_ENABLE` - Whether or not to enable the VMC (verification method cache) tasks. Default `true`.
1819* `PLC_HOSTNAME` - The hostname of the PLC server to use for VMC tasks. Default `plc.directory`.
···11+# Playbook: Enable compression
22+33+Jetstream supports optional zstd compression for streamed events. This feature can reduce bandwidth usage by up to 50% with minimal performance impact, but at the cost of a more complicated deployment and additional maintenance steps.
44+55+[zstd](https://github.com/facebook/zstd) is a dictionary-based compression algorithm that is optimized for real-time compression and decompression.
66+77+## Configuration
88+99+Compression is enabled by setting the `COMPRESSION` environment variable to `true`. When enabled, the `ZSTD_DICTIONARY` environment variable must be set to the path of the ZSTD dictionary to use.
1010+1111+The dictionary file can be downloaded from [github.com/bluesky-social/jetstream/blob/main/pkg/models/zstd_dictionary](https://github.com/bluesky-social/jetstream/blob/main/pkg/models/zstd_dictionary).
1212+1313+## FAQ
1414+1515+### Why is compression disabled by default?
1616+1717+The benefits of compression are not guaranteed and depend on the data being compressed. For most supercell deployments, the impact on CPU and memory is minimal, and the benefits of reduced bandwidth is significant. However, this feature is maturing and may not be suitable for all deployments.
1818+1919+### Why is a custom dictionary required?
2020+2121+Zstd uses a dictionary to improve compression performance. There is no default dictionary, so a custom dictionary must be provided.
2222+2323+The dictionary is occasionally rebuilt to improve compression performance. The dictionary is built from a sample of the data that is being compressed, so the dictionary is specific to the data that is being compressed.
2424+2525+### Dictionary mismatch
2626+2727+This error occurs when compression is enabled and the dictionary is invalid or does not match the dictionary that was used to compress the data.
2828+2929+To resolve, ensure the `ZSTD_DICTIONARY` environment variable is set to the correct path and that the file at that path is the same as the one from the jetstream repository.
3030+3131+### Destination buffer is too small
3232+3333+This error occurs when the buffer used to decompress the data is too small to contain the decompressed event.
3434+