scgi_buffering
The 'scgi_buffering' directive enables or disables buffering of responses from SCGI servers in NGINX.
Description
The 'scgi_buffering' directive controls whether NGINX buffers responses from SCGI (Simple Common Gateway Interface) servers before sending them to the client. By default, NGINX buffers these responses, which can improve performance by sending complete response data in a single transmission. If buffering is enabled and the response is larger than the configured buffer size, NGINX will write the data to a temporary file if it exceeds this limit. Conversely, if buffering is disabled, NGINX will stream the response data to the client immediately as it is received from the SCGI server, which can be beneficial for long responses or streaming applications where low latency is a priority. The directive accepts a flag argument, which can be either 'on' or 'off'.
Config Example
server {
location /app {
scgi_pass 127.0.0.1:9000;
scgi_buffering off;
}
}Disabling buffering may lead to performance degradation under high load, as streaming responses may not be as efficient as buffered ones.
Make sure that the SCGI server can handle the immediate responses sent by NGINX when buffering is turned off.