scgi_busy_buffers_size
The `scgi_busy_buffers_size` directive specifies the size of buffer for storing busy SCGI responses in NGINX.
Description
The scgi_busy_buffers_size directive is an essential configuration option that determines the size of the buffer allocated for busy SCGI responses that are not yet sent to the client. In the context of handling SCGI requests, buffers are critical as they allow the server to manage data efficiently while awaiting responses from the FastCGI or SCGI upstream servers. The buffer size can affect the performance of the server under load, especially when handling large payloads or high-request rates.
When a request is processed and the upstream response is not immediately sent to the client, the response is temporarily stored in a busy buffer. The scgi_busy_buffers_size sets the total size of all the busy buffers allocated for processing requests within the specified context (http, server, location). If the specified size is exceeded, additional mechanisms come into play, such as buffering limitations and possible rate-limiting. This directive should be configured based on the expected load and the size of responses that the server typically handles, ensuring that performance remains optimal.
The parameter for this directive is measured in bytes and can take a value as needed to accommodate the expected workload. It’s worth noting that this directive works in conjunction with other SCGI-related settings, and its effectiveness is tied to the overall configuration of request handling, timeouts, and upstream server behavior.
Config Example
http {
scgi_busy_buffers_size 32k;
}Setting the buffer size too small may result in dropped requests or excessive buffering, leading to increased latency.
Large buffer sizes can increase memory usage significantly, so it's important to balance performance needs with available resources.