nchan_permessage_deflate_compression_level

Sets the gzip compression level for WebSocket messages in NCHAN.

Syntaxnchan_permessage_deflate_compression_level level;
Default6
Contexthttp
Arguments1

Description

The nchan_permessage_deflate_compression_level directive specifies the compression level for permessage-deflate in WebSocket connections using the Nchan module. This directive takes a single integer argument that defines the level of compression applied to messages, ranging from 0 (no compression) to 9 (maximum compression). Higher compression levels decrease the size of the transmitted data but can increase CPU usage since more processing is required to compress and decompress the messages.

When enabled, the directive applies to messages sent over WebSocket channels managed by Nchan. It is particularly useful in scenarios where bandwidth is limited or where large amounts of data are transmitted frequently, as this can significantly reduce the payload size and improve the overall transmission efficiency. However, users should consider the trade-off between compression level and performance; while higher compression levels can save bandwidth, they may also lead to increased latency due to the processing time required for compression.

Properly configuring this directive can lead to a noticeable performance improvement in data-heavy applications or services, especially in real-time messaging situations. It allows administrators to find a balance that caters to their specific network environment and application needs.

Config Example

http {
    nchan_permessage_deflate_compression_level 5;
}

Setting the compression level too high may lead to excessive CPU usage, especially under heavy load conditions.

If WebSockets are not being used, this directive will not have any effect on message transmission.

← Back to all directives