uwsgi_buffer_size

The `uwsgi_buffer_size` directive sets the size of the buffer used for reading the first part of the response from the uWSGI server.

Syntaxuwsgi_buffer_size size;
Default4k
Contexthttp, server, location
Arguments1

Description

The uwsgi_buffer_size directive in NGINX controls how much memory is allocated for buffering the initial response from the uWSGI server. This directive is crucial when working with applications that communicate via the uWSGI protocol, particularly regarding how data is retrieved and sent back to the client. The value specified will define the size of a buffer that holds the headers of the response once they are received from the uWSGI application.

A larger buffer allows for greater flexibility with the size of the headers that can be processed without requiring multiple reads from the uWSGI protocol, reducing the potential for performance issues. It's worth noting that if the uWSGI server sends headers larger than the specified buffer size, NGINX might generate an error or truncate the headers. Therefore, configuration should carefully consider the expected size of headers generated by the application.

This directive accepts a single argument, which is the size of the buffer to be allocated. The size can be specified in bytes, or using suffixes like k for kilobytes, m for megabytes. The effective use of this directive contributes significantly to the smooth operation of web applications reliant on uWSGI.

Config Example

uwsgi_buffer_size 8k;

Setting the buffer size too low can lead to errors if the headers exceed the designated size.

Using excessive buffer size may lead to wasted memory if the application doesn't require such large buffers.

← Back to all directives