postpone_output

The 'postpone_output' directive allows NGINX to delay sending output to the client until necessary, optimizing resource usage. — NGINX HTTP Core

postpone_output
httpserverlocation
Синтаксисpostpone_output number;
По умолчаниюnone
Контекстhttp, server, location
МодульNGINX HTTP Core
Аргументы1

Описание

The 'postpone_output' directive is particularly useful in scenarios where a response can be generated but is not immediately required to be sent to the client. This directive informs NGINX that the response body can be postponed, allowing the server to manage memory and processing more effectively by deferring the output. When this directive is enabled, the NGINX worker process does not immediately flush the response data to the client's socket, which can help improve performance by reducing the number of system calls and allowing the server to handle multiple requests simultaneously without excessive output blocking. The directive takes one parameter, which specifies the maximum amount that can be postponed. When a response has been fully constructed but the client is busy or slow to process data, this directive helps ensure that resources are not wasted on output. It operates at the HTTP level, and its effects can be included in the configuration files for the HTTP, server, and location contexts, allowing for flexible application across different scopes of server handling.

Пример конфига

location /example {
    postpone_output 1024;
}

Ensure the postponed output size does not cause buffer overflows.

Using postpone_output in inappropriate contexts may lead to unwanted behaviors.