memc_upstream_fail_timeout

Specifies the timeout for failover attempts when upstream memcached servers are unavailable.

Syntaxmemc_upstream_fail_timeout time;
Default10s
Contexthttp, server, location
Arguments1

Description

The memc_upstream_fail_timeout directive is utilized within the NGINX configuration to define a timeout period for handling failures in upstream memcached servers. This directive is crucial for scenarios where connectivity issues may arise; it ensures that the NGINX server can manage failovers more effectively by waiting for a specified duration before attempting to retry connecting to an upstream server that has previously failed. By setting this timeout, you allow NGINX to try alternative upstream servers without flooding your system with rapid retry attempts that could lead to degraded performance or resource exhaustion.

The parameter for memc_upstream_fail_timeout is structured as a time value, which can be specified in various formats (like seconds or with time suffixes such as 'm' for minutes). When an upstream server is marked as failed, NGINX will respect this timeout before considering the server for another attempted connection. This helps in balancing the load and managing requests during transient failures effectively. By providing a controlled retry strategy, administrators can minimize the impact of temporary server downtimes on user experience.

Config Example

location /memcached {
    set $memc_key $arg_key;
    memc_pass 127.0.0.1:11211;
    memc_upstream_fail_timeout 5s;
}

Setting the timeout too low may lead to frequent failovers and unnecessary retries, impacting performance.

Ensure that this directive is set in the appropriate context (http, server, or location) or it will not take effect.

← Back to all directives