Proxy high availability
Remove the proxy as a single point of failure
High availability (HA) means continuing to provide an acceptable service despite defined failures. Two Nginx processes on one machine do not survive a machine outage. Put independent proxy instances in separate failure domains (groups of components likely to fail together), and provide a redundant traffic-entry mechanism. In the example, an external health-aware load balancer directs traffic to either proxy. Each proxy can reach either application replica. A shared database remains a dependency, and the entry load balancer must itself be resilient. A request can still fail while traffic is being redirected.
Client -> redundant entry load balancer |-> proxy A (zone A) -> app A or app B |-> proxy B (zone B) -> app A or app BApps -> durable data service (separate recovery design)Configure each proxy independently
Use a shared upstream zone to coordinate upstream runtime state among workers of one Nginx instance. This is not a distributed cluster. Passive detection depends on attempted traffic and the configured failure conditions. With two peers and the settings below, an unsuccessful attempt meeting the failure criteria can temporarily exclude a peer; that does not prove a separate proxy has excluded it. The example is a complete fragment inside http, using fixed local lab ports and an explicit retry bound. The two backends are assumed to provide a read-only catalog; do not extend retry behavior to unsafe writes without a reviewed application contract.
upstream catalog { zone catalog 64k; server 127.0.0.1:19081 max_fails=1 fail_timeout=10s; server 127.0.0.1:19082 max_fails=1 fail_timeout=10s;}server { listen 127.0.0.1:19080; location / { proxy_pass http://catalog; proxy_next_upstream error timeout; proxy_next_upstream_tries 2; }}Active-active versus active-passive
Active-active means both proxy instances normally serve traffic. Active-passive reserves a standby to take over the service endpoint, often a virtual IP (VIP) on supported networks. F5 documents a separate keepalived-based HA package for supported Plus on-premises environments and configurations for multiple active nodes. The VIP mechanism is not built into ordinary Nginx HTTP proxying. Confirm network support, failover fencing, health criteria and exact package support before adoption. Cloud load balancers and DNS-based routing are different mechanisms; do not assume an on-premises floating IP can be moved in every cloud.
Active-active: A=serving, B=serving; remove A -> B serves eligible new trafficActive-passive: A=VIP owner, B=standby; transfer ownership only after safe failoverBoth: verify the client-visible request and durable data pathReserve capacity for failure and maintenance
Suppose each proxy has a measured safe capacity of 700 requests per second at the required latency and error rate. Demand is 1,000 requests per second. Two proxies normally have 1,400 units of capacity, but losing one leaves only 700. Under this simplified additive-capacity model, three such proxies retain 1,400 after a single loss; 400 units are spare at that demand. These are hypothetical numbers, not a benchmark. Check backend and entry-tier capacity too. A rolling upgrade should drain one node, verify the remaining service and return the node only after readiness checks. For multi-region designs include region-wide losses, data replication latency, dependency locality and traffic routing convergence.
Demand: 1000 requests/s2 x 700, loss of one: 700 < 1000 -> insufficient3 x 700, loss of one: 1400 >= 1000 -> illustrative passRemaining margin = 1400 - 1000 = 400 requests/sApply what you learned
Practice: Demand is 1500 requests/s; each independent proxy safely handles 600. Find the minimum number that can survive losing any one proxy in the simplified model. Sketch redundant entry and data dependencies. Work from the stated assumptions; the manual exercise and quiz are staged separately. Related references and next lesson are listed in the chapter authored map.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Proxy high availability
Assess high-availability and recovery reasoning.
Both proxies run on one VM. What remains?
What does an HTTP upstream zone coordinate?
What normally serves traffic in active-passive HA?
Three proxies each handle 700 requests/s safely. One fails. What is the simplified remaining capacity?
Why check the application after draining a proxy?