advanced35 min studyLesson 76 in Engineering

Multi-region failover

Plan regional traffic movement together with write authority, replication state, spare capacity, and a controlled failback.

On this page

What you’ll understand

  • Calculate surviving-region capacity for a specified failure and workload.
  • Explain why traffic redirection does not establish safe write authority.
  • Design failover and failback evidence around data state and user outcomes.

A second region is useful only if it can perform the required operation when the first region becomes inaccessible. Routing, data, identity, deployment artifacts, and operational control must all remain usable. Some systems replicate asynchronously and accept a potential loss window; others require remote acknowledgement and spend cross-region latency on the normal path. Failover is therefore a transition in both serving location and state authority. We will model capacity and recovery time without assuming that moving traffic solves correctness.

Budget the failed-region workload explicitly

Write down which traffic survives a regional loss, where it goes, and which features can be degraded. A destination's normal utilization is not the same as its failover headroom. Include cold caches, connection storms, replication catch-up, request mix, and autoscaling delays in a measured failover workload. Spare compute without sufficient database throughput or network quota may be unusable. If capacity must be acquired during the incident, test that dependency and acknowledge the risk of simultaneous demand from other users of the same infrastructure.

Active-active deployment spreads ordinary traffic, while active-passive deployment keeps a destination idle or partly warm. Neither label specifies the data consistency model or the actual spare capacity. A two-region design running both regions near saturation cannot absorb losing one without shedding work or adding capacity. Predefine which request classes are admitted after a failure, and ensure the destination can reject excess work cheaply. Regional failover should not convert a contained outage into global overload through unbounded retries and redirected traffic.

usurviving=Lrequired∑i∈SCiu_{\mathrm{surviving}}=\frac{L_{\mathrm{required}}}{\sum_{i\in S} C_i}
For a fixed representative workload, Lrequired is required service demand and Ci is measured usable capacity in each surviving region S, expressed in the same units. The resulting utilization ratio omits transient cold-state and bottleneck effects unless those were included in the measurements.↔ Scroll wide equations horizontally.

Separate reachability from write authority

A region can be unreachable from an observer while still processing requests from other clients. Promoting a new writer merely because a probe timed out risks conflicting writers. Use the datastore's supported promotion and fencing protocol to determine authority, and verify the state that will be served. A fencing mechanism must be enforced at the protected resource; an old process remembering that it once held a lease is insufficient. Manual intervention must follow the same safety model rather than bypassing it under pressure.

For asynchronous replication, record what has reached the recovery destination and how that relates to acknowledged user writes. A measured lag sample does not guarantee a maximum loss bound during every failure. For synchronous replication, determine which acknowledgements define durability and what happens when the remote path is unavailable. Changing a quorum membership or forcing a promotion is a protocol operation, not a count adjustment. Reconcile in-flight operations, idempotency records, and external side effects before treating the destination as a coherent replacement.

Trecover=Tdetect+Tdecide+Tpromote+Troute+TverifyT_{\mathrm{recover}}=T_{\mathrm{detect}}+T_{\mathrm{decide}}+T_{\mathrm{promote}}+T_{\mathrm{route}}+T_{\mathrm{verify}}
This sequential planning model sums detection, decision, safe promotion, traffic convergence, and verification durations. Real tasks may overlap, so use a critical-path model and measured exercises for a production recovery forecast.↔ Scroll wide equations horizontally.

Rehearse the return path

Routing convergence depends on client caches, connection reuse, health checks, and the routing mechanism. Do not equate a DNS TTL with a guaranteed global switch time. Observe successful operations from relevant client locations and retain a way to pause traffic movement if the destination saturates. Verify that administrative access, secrets, certificates, deployment images, and telemetry do not depend entirely on the failed region. A runbook that requires downloading credentials from the unreachable environment contains a circular recovery dependency.

Failback deserves the same care as failover. Restore the failed region as a follower or otherwise reconcile it using the supported protocol; do not simply restart the former writer and redirect users. Confirm replication convergence, capacity, and rollback conditions before moving traffic in stages. In the replica lab, compare losing one node with losing the several nodes assigned to one region. The diagram only counts up nodes and a majority; it cannot model placement, partitions, promotion safety, or recovery data. Supply those details in the written failure plan.

Capacity and the sequential recovery path

A fictional service needs 12,000 operations/s under its failover workload. Each of two regions was measured to sustain 15,000 operations/s within the required latency bound, including warm-state overhead. One region fails. Planned sequential stages are 20 s detection, 10 s decision, 30 s promotion, 40 s routing, and 20 s verification.

  1. One surviving region has 15,000 operations/s measured usable capacity, so modeled post-failure utilization is 12,000/15,000 = 0.8, or 80%.

  2. Headroom is 15,000 − 12,000 = 3,000 operations/s for the measured workload. Cold-cache effects still require separate validation if absent from that measurement.

  3. The sequential recovery plan totals 20 + 10 + 30 + 40 + 20 = 120 seconds. An objective shorter than two minutes is not supported by this plan.

The result

The capacity arithmetic is plausible, but recovery remains conditional on state safety, routing convergence, and the actual failure workload. An exercise must validate those assumptions and the measured critical path.

Explore the model

Interactive lab

Interactive lab · reliability

A region can remove multiple replicas

Adjust n and k to compare surviving replicas with floor(n/2) + 1. On paper, assign replicas to regions and remove a whole region's count rather than assuming one regional outage removes only one node.

A region can remove multiple replicasA replica count and a majority threshold, without a consensus protocol. Playback highlights fixed replica states. Having a majority alone does not establish linearizability, durability or failure independence. Current readings: Available replicas: 4 of 5; Majority needed: 3; Majority available?: Yes. All parameters are adjustable with the labeled controls below.Majority available · need 3 of 5Playback highlights fixed statesR1 · upR2 · upR3 · upR4 · upR5 · downCyan mark: majority threshold
AvailableUnavailableMajority threshold
Available replicas
4 of 5
Majority needed
3
Majority available?
Yes
t = 0 s

A replica count and a majority threshold, without a consensus protocol. Playback highlights fixed replica states. Having a majority alone does not establish linearizability, durability or failure independence. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forMajority availability is a count condition; regional placement and safe write authority require a real protocol.

Check your understanding

A health checker cannot reach the old primary. Why is immediate promotion without fencing unsafe?

Try it yourself

Three regions each provide 8,000 operations/s of measured usable capacity. A workload requires 12,000 operations/s. Compute utilization after losing one region and after losing two. Explain what the second result implies for admission.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Divide required load by the summed surviving capacity and interpret values above one as unmet demand.

Compare with the solution

With two regions left, utilization is 12,000/16,000 = 75%. With one left, it is 12,000/8,000 = 150%, so at least 4,000 operations/s must be deferred, rejected, degraded into cheaper work, or supported by additional tested capacity. Simply routing all requests to the survivor would exceed the measured envelope and may trigger a cascade.

Take it with you

  • Failover capacity must include the actual destination workload and recovery transients.
  • A failed probe does not prove that the previous writer lost authority.
  • Test failback, administrative dependencies, and client routing convergence.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.