Web / NGINX Interview questions
What happens when an upstream server fails a health check?
When passive health checks are configured via max_fails and fail_timeout on a server line, NGINX tracks failed connection attempts or error responses from that upstream server as real traffic flows through.
upstream backend_app { server 10.0.0.11:8080 max_fails=3 fail_timeout=30s; server 10.0.0.12:8080; }
Once a server accumulates max_fails failures within the configured time window, NGINX marks it unavailable and stops routing new requests to it for the duration of fail_timeout. Traffic continues flowing to the remaining healthy servers in the pool during that time.
After the timeout expires, NGINX cautiously sends a trial request to the marked server; if it succeeds, the server is returned to the active pool, and if it fails again, it stays marked down for another cycle. NGINX Plus adds active health checks that proactively probe servers on a schedule instead of only reacting to real traffic failures.
More Related questions...