nchan_permessage_deflate_compression_window

The nchan_permessage_deflate_compression_window directive configures the buffer size used for per-message compression of WebSocket messages in the Nchan module.

Syntaxnchan_permessage_deflate_compression_window size;
Defaultnone
Contexthttp
Arguments1

Description

The nchan_permessage_deflate_compression_window directive in the Nginx Nchan module affects the compression behavior of messages sent through WebSocket connections. Specifically, it defines the window size for the per-message compression when the deflate algorithm is applied, allowing for a trade-off between compression efficiency and memory usage. This directive is particularly useful in scenarios where minimizing data transfer size is crucial, yet the overhead of compression and decompression must be balanced against performance considerations.

When enabled, a larger window size can lead to better compression ratios, especially for repetitive data. However, it also increases memory usage per message and can potentially introduce latency in message processing. Therefore, it is essential to choose an optimal value that aligns with the desired balance between performance and the physical size of transferred data. The behavior is affected by the underlying implementation of the compression mechanism, as well as the nature of the data being transmitted through the channels defined in Nchan.

The directive accepts an integer value that specifies the window size, in bytes. Depending on the setup and use case, users might want to carefully test different configurations to achieve the best results for their specific workloads.

Config Example

nchan_permessage_deflate_compression_window 2048;

Using excessively large values can lead to increased memory usage, affecting the performance of the server.

← Back to all directives