subrequest_output_buffer_size

Sets the size of the output buffer for subrequests in NGINX.

Syntaxsubrequest_output_buffer_size size;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The subrequest_output_buffer_size directive in NGINX controls the maximum amount of data that can be buffered for the output of subrequests. Subrequests are initiated to obtain additional data or resources during the processing of a request, such as including a different file or executing another server location. By specifying this directive, an administrator can fine-tune memory usage depending on the expected response sizes of subrequests, which could improve performance under load.

The value set for the directive determines how much data can be held in the buffer for subrequests. If the output generated by a subrequest exceeds this value, it will trigger additional buffering mechanisms or directly send the output, potentially influencing performance and memory consumption. The appropriate setting depends on the expected use cases for subrequests and the memory configurations of the server.

Config Example

server {
    location /example {
        subrequest_output_buffer_size 16k;
    }
}

Setting the buffer too low may lead to performance degradation as data is sent out more frequently.

Too high values can lead to excessive memory consumption if not managed properly.

← Back to all directives