keepalive_min_timeout

Sets the minimum timeout for keep-alive connections between NGINX and clients.

Syntaxkeepalive_min_timeout time;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The keepalive_min_timeout directive specifies the minimal timeout duration for keep-alive connections. This timeout duration is crucial as it determines how long an inactive connection can remain open before NGINX closes it. By default, the keep-alive timeout is set to 75 seconds, as specified by the keepalive_timeout directive, but it can take longer for high-latency network connections or when dealing with sluggish clients. Setting keepalive_min_timeout sets an expected minimum timeout, providing some control over how aggressively idle connections are dropped.

This directive accepts one argument, which defines the minimum timeout duration in seconds. It is particularly useful for optimizing server performance under heavy load by balancing the need for long-lived connections with the need to free up resources promptly. Keep in mind that a very low keepalive_min_timeout can lead to dropped connections and possible increase in latency for subsequent requests from the same client, making this configuration a critical consideration for web applications that utilize persistent connections.

This directive can be defined in http, server, or location contexts, giving you the flexibility to apply different keep-alive timeout settings based on your application's needs. With the right configuration, you can ensure that your server supports efficient TCP connection handling without unnecessary strain from excessive idle connections.

Config Example

keepalive_min_timeout 10s;

Setting a value too low may cause connections to close prematurely, impacting user experience.

This directive may override the default keepalive timeout settings, ensure to configure it in tandem with keepalive_timeout if needed.

← Back to all directives