ajp_upstream_fail_timeout
The `ajp_upstream_fail_timeout` directive configures the duration NGINX will wait before considering an upstream AJP server as failed after a connection failure.
Description
The ajp_upstream_fail_timeout directive is used in NGINX's AJP (Apache JServ Protocol) module to establish a failover mechanism for upstream servers. When an AJP request fails due to an upstream server being unreachable, this directive dictates the time period after which NGINX will re-attempt to connect to the failed server. Essentially, it allows NGINX to wait for a specified duration before marking the server as failed and temporarily excluding it from request routing. This behavior helps in preventing excessive failure flags for transient issues, allowing the server to recover before being permanently removed from the pool.
The parameter for ajp_upstream_fail_timeout is specified in a time format (e.g., 30s for thirty seconds). Setting it to a suitable duration is critical for balancing between responsiveness to server outages and not too aggressively marking a server down; factors such as the nature of the application and the expected downtime can influence this setting. The directive can be placed within http, server, or location contexts, providing flexibility in how failover is managed across different parts of your NGINX configuration.
Config Example
http {
upstream tomcats {
server 127.0.0.1:8009;
ajp_upstream_fail_timeout 30s;
}
server {
listen 80;
location / {
ajp_pass tomcats;
}
}
}Setting the timeout too low may lead to frequent server failures being triggered for transient issues.
Ensure that the fail timeout is long enough for valid recovery situations, but not so long that it hampers overall performance.