ajp_upstream_max_fails

Sets the maximum number of failed attempts before removing a failed server from the AJP upstream group.

Syntaxajp_upstream_max_fails number;
Default1
Contexthttp, server, location
Arguments1

Description

The ajp_upstream_max_fails directive defines the limit on how many unsuccessful attempts NGINX will allow when connecting to an upstream AJP server before it marks that server as failed. This directive is essential for maintaining high availability and performance of applications using the AJP protocol by helping to avoid excessive load on malfunctioning upstream servers.

When the specified number of failed attempts is reached, NGINX will temporarily remove the server from the load balancing pool, preventing future requests from being routed to it until it is deemed healthy again based on the configured health check mechanisms. This parameter is particularly useful in environments with dynamic upstream servers, such as those orchestrated by container management platforms, where server availability may fluctuate frequently.

The directive can be adjusted depending on application requirements and the environment — for instance, in a highly dynamic system, a lower number of max fails might be preferable to quickly react to failing servers, while in a stable setup, a higher number could be beneficial to maintain fault tolerance during transient issues.

Config Example

upstream my_ajp_backends {
    server 127.0.0.1:8009;
    ajp_upstream_max_fails 3;
}

Setting ajp_upstream_max_fails too low may lead to frequent removal of servers that are temporarily down.

Ensure that health checks are appropriately configured to bring servers back after they have been marked as failed.

← Back to all directives