redis2_send_timeout

Sets the timeout for sending requests to a Redis server.

Syntaxredis2_send_timeout timeout;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The redis2_send_timeout directive defines the maximum time allowed for NGINX to send a request to the Redis server before timing out. This timeout can be critical in ensuring that slow connections or unresponsive Redis servers do not block the processing of requests in NGINX. When the time specified expires without successfully sending the request, NGINX will terminate the connection and return an error to the client.

This directive can be configured in the http, server, and location contexts, allowing for granular control over connection behavior to individual Redis backends or across the entire NGINX configuration. The timeout duration is specified in milliseconds, making it precise and suitable for high-performance environments where network latency can vary significantly. If not set, requests may use a default timeout, which might not align with specific application requirements.

Config Example

location /redis {
    redis2_pass 127.0.0.1:6379;
    redis2_send_timeout 200ms;
}

Make sure to set a reasonable timeout; too short may cause frequent timeouts, while too long may lead to slow response times.

This directive applies only to requests sent to Redis; ensure you set it thoughtfully based on your application's performance needs.

← Back to all directives