uwsgi_busy_buffers_size

Sets the size of the buffer used for storing response data from uWSGI servers in NGINX.

Syntaxuwsgi_busy_buffers_size size;
Default16k;
Contexthttp, server, location
Arguments1

Description

The uwsgi_busy_buffers_size directive defines the maximum size of the buffer that can be used to hold data when NGINX communicates with uWSGI servers. This is particularly important for maintaining performance when handling large responses. If the size of the response generated by a uWSGI server exceeds this limit, NGINX will employ additional mechanisms to handle the overflow, which could lead to additional resource usage and may affect overall performance.

The size specified for uwsgi_busy_buffers_size should be carefully considered in conjunction with other related buffer settings. When there are multiple uWSGI responses being processed simultaneously, this buffer can fill up quickly, so NGINX will usually buffer the first uwsgi_busy_buffers_size bytes and start processing them while handling more data accordingly. The directive can be set in the HTTP, server, or location context, allowing flexible configuration for different scopes of NGINX server instances.

It is crucial to test the impact of various buffer sizes under realistic scenarios to avoid undesirable behaviors, such as increased latency or resource thrashing. Advanced tuning based on the specific workload and response sizes from uWSGI should be undertaken to find the right balance between resource consumption and performance.

Config Example

http {
    uwsgi_busy_buffers_size 32k;
}

server {
    location / {
        uwsgi_pass unix:/var/run/uwsgi.sock;
        uwsgi_busy_buffers_size 64k;
    }
}

Setting this value too low can lead to additional overhead, as NGINX may need to perform more context switching when handling larger responses.

Excessively high values can exhaust system memory, especially under heavy load. Use with caution.

← Back to all directives