Two HAProxy boxes, a customer asking “do we go active-active or active-passive,” and an architect’s instinct that active-active sounds better because it uses both boxes. The instinct is wrong about half the time. Active-active doubles your steady-state capacity and doubles your failure surface — sometimes that’s the right trade, sometimes the boring active-passive box waiting on a VRRP heartbeat is what production wants. This article is the decision tree, with the operational implications laid out.
How to verify
Confirm what the current pair is actually doing before deciding what they should do:
# Are both LBs receiving client traffic, or only the master?
# Per-box: count connections to the listening port over 30s
ss -ntp state established "( sport = :443 )" | wc -l
# VRRP / Keepalived state — MASTER vs BACKUP
sudo cat /var/run/keepalived/keepalived.state 2>/dev/null \
|| sudo journalctl -u keepalived | tail -50 | grep -E 'STATE|MASTER|BACKUP'
# If active-active via DNS round-robin: are both A records being returned?
dig +short example.com @1.1.1.1
dig +short example.com @8.8.8.8
# Or ECMP via BGP: is the upstream router announcing both /32s with equal cost?
vtysh -c 'show ip route example-vip'
If only the master shows established connections and the backup is idle, you’re active-passive — even if someone called it active-active. If both show traffic with consistent client-IP distribution, you’re genuinely active-active.
Decision
There are three reasons to put two load balancers in front of an application, and they map to different patterns:
Reason 1: fail over within seconds when one LB dies. Active-passive with VRRP/keepalived. One box holds a virtual IP; the other waits for a heartbeat miss and takes the VIP over. Failover in 3-5 seconds, no state lost (clients just see one connection drop and reconnect). Simple to operate, dead-simple to reason about, and the standby box is genuinely idle — wasted hardware but zero risk of split-brain.
Reason 2: get more capacity than one box can provide. Active-active via ECMP (Equal-Cost Multi-Path) at the network layer, or DNS round-robin if you don’t have the network primitives. Both LBs handle traffic concurrently; failure of one drops half the capacity but no full outage. This is what big edges run.
Reason 3: keep things running during an LB upgrade or restart. Both patterns handle this — active-passive by failing over before the upgrade, active-active by gracefully draining one node at a time.
The two patterns differ on five real dimensions:
- Capacity ceiling. Active-passive caps at the capacity of one box. Active-active caps at the sum minus a margin for failure-mode load. If your peak is well under a single box, active-passive is fine; if peak is approaching it, active-active is mandatory.
- State handling. Active-passive can keep session state local (HAProxy stick-tables on the master, replicated via peers). Active-active needs shared state — every box must know every sticky session. That’s stick-table replication via HAProxy peers, or a shared Redis, or no sticky sessions at all.
- Failure surface. Active-passive has one path of traffic at a time; you only debug the master. Active-active has two, and a misconfigured backend timeout on box B that doesn’t exist on box A will give you intermittent failures that are very hard to find. Twice the boxes, twice the divergence risk.
- Network requirements. Active-passive needs VRRP on a shared L2 (or cloud-vendor VIP equivalents). Active-active via ECMP needs BGP with the upstream router and consistent-hash ECMP support. Active-active via DNS needs accepted-tradeoff DNS TTLs and clients that respect them.
- Cost story. Active-passive: pay for two boxes, use one. Active-active: pay for two boxes, use both, but oversize each so a single failure doesn’t tip you into a cascade.
The decision tree:
- Peak traffic less than ~60% of a single LB’s measured capacity? Active-passive. The standby is wasted hardware, but the operational simplicity is worth it. Most B2B SaaS at small/medium scale fits here.
- Peak traffic over 60% of a single LB? Active-active is needed for headroom. Pick the network mechanism that fits — ECMP with BGP on bare metal, network load balancer in front of two app-LBs in cloud, GeoDNS for multi-region.
- Need cross-region failover? That’s a different pattern entirely (GSLB / GeoDNS / Anycast), not what active-active vs active-passive refers to. The local pair decision is independent of the multi-region one.
- Tight session-affinity requirements (e.g. WebSocket, long-lived connections)? Active-passive keeps affinity trivially. Active-active needs an L4 hash that stays consistent across both LBs, plus stick-table replication.
The procedure
Whichever you pick, the operational hygiene is the same:
-
Document which box is doing what right now. Add a
/lb-statusendpoint or a header that tells you which LB processed a given request. Without this, every weird symptom is a guess. -
Run config drift detection. Both boxes must run identical configs — diff them after every change. A single misaligned
timeout serverbetween active-active peers causes the kind of bug that takes a month to chase down. -
For active-passive: rehearse the failover. Quarterly drill where you
systemctl stop keepalivedon the master and time the recovery. If it takes more than 10 seconds, yourvrrp_instanceconfig has a problem — usuallyadvert_inttoo long orprioritynot differing enough. -
For active-active: rehearse the half-capacity drill. Take one LB out of rotation and watch the other for 30 minutes. The remaining box should hold at the expected load with headroom. If it tips, your sizing assumes both boxes are always up — that’s not active-active, that’s “two boxes splitting fragile load.”
-
Wire monitoring to both, not just the active. A backup box that has been silently broken for three months won’t take over when you need it. Health-check the standby’s HAProxy, sysstat, and disk pressure too.
Operational notes
- VRRP failover times depend on
advert_int(advertisement interval, default 1s) andgarp_master_delay(gratuitous ARP delay). Sub-second failover requiresadvert_int 0.5and matters less than people think — TCP connections survive a 2-3 second pause. - Cloud VIPs (AWS Elastic IP, GCP forwarding rules) are not VRRP. You’re API-calling the cloud provider to move the IP, and that’s slower (10-30 seconds) and rate-limited. Plan failover budgets accordingly.
- DNS-based active-active is “active-active for new connections only.” Existing connections stick to whichever LB they hit; failover for in-flight connections doesn’t happen until the client reconnects.
- BGP/ECMP active-active assumes ECMP is configured with a flow hash that’s stable across LB hops — most modern hardware does, but legacy core routers may rehash on link flap and break sticky sessions silently.
- Active-active with stateful sticky sessions and stick-table replication has a write-amplification cost: every sticky session insert on box A is replicated to box B. Under heavy churn this can saturate the peer link.
Stack Harbor designs and operates LB pairs in both patterns depending on the workload — VRRP active-passive for the simple cases, ECMP or cloud-NLB-fronted active-active where capacity demands it, and the runbooks that go with whichever pattern we pick. This is core to how we deliver managed operations on web infrastructure.