gunzip_buffers

The gunzip_buffers directive configures buffer sizes for decompressed response data in NGINX.

Syntaxgunzip_buffers number size;
Defaultgunzip_buffers 4 16k;
Contexthttp, server, location
Arguments2

Description

The gunzip_buffers directive specifies the number and size of buffers used to hold decompressed data from HTTP responses. This directive is particularly useful when dealing with Gzip-compressed content that is being sent to the client, as it allows NGINX to manage the memory allocation for the decompressed data efficiently. The first parameter defines the number of buffers, while the second parameter specifies the size of each buffer in bytes. When a Gzip-compressed response is processed, NGINX will use these buffers to temporarily store the uncompressed data before sending it to the client.

Using the gunzip_buffers directive can improve performance by optimizing memory usage during the decompression process. By default, the directive may not be set, which means NGINX will use built-in buffer sizes for handling decompressed data. Administrators may want to tune these parameters to suit their application's characteristics, especially when handling large files or high traffic volumes, where the right buffer sizes can prevent performance bottlenecks. In summary, this directive is versatile and can enhance the efficiency of response handling in NGINX when Gzip-compressed content is in play.

Config Example

http {
    gunzip on;
    gunzip_buffers 8 16k;
}

Ensure that the buffer sizes are adequate to handle the maximum expected decompressed response size.

Be cautious when setting very large buffer sizes, as this may lead to increased memory usage.

If gunzip is not enabled, this directive will have no effect.

← Back to all directives