unbrotli_buffers

The `unbrotli_buffers` directive sets the number and size of buffers used for decompressing Brotli-encoded responses.

Syntaxunbrotli_buffers number size;
Defaultdepends on system page size, commonly: `32 4k`;
Contexthttp, server, location
Arguments2

Description

The unbrotli_buffers directive is crucial in managing how NGINX handles Brotli-encoded responses for clients that do not support this encoding. This directive takes two parameters: the first specifies the number of buffers, while the second defines the size of each buffer. These buffers are essential for temporarily holding the Brotli data during decompression before it is sent out to clients.

The default behavior and size of these buffers depend on system memory page size, but it is typically set to something reasonable like 32 4k, meaning 32 buffers with a size of 4 kilobytes each. This arrangement often helps optimize memory usage while balancing performance needs when decompressing larger data streams. If the response sizes are mostly large, you may want to increase the number or size of buffers to improve performance, at the cost of higher memory consumption.

When configuring the unbrotli_buffers, it's important to consider your server's capabilities and the expected response sizes, as well as the overall memory limits of your environment. Decompressing larger payloads using insufficient buffer sizes may result in suboptimal performance or even service degradation due to excessive memory allocations or increased CPU usage.

Config Example

location /storage/ {
    unbrotli on;
    unbrotli_buffers 32 4k;
}

Ensure that the number of buffers and their sizes do not exceed available memory limits, especially under high load scenarios.

Be mindful that an increased buffer size could lead to higher memory consumption, potentially impacting server performance under constrained resources.

← Back to all directives