Sub topic 12
Failure modes: regional outages, partial failures and split brain
This chapter covers the ways a multi-region system fails and how each failure looks from the inside. It assumes you know basic DNS and load balancing, the difference between synchronous and asynchronous replication, and the consistency trade-offs from the earlier chapters. Active-active designs survive many failures. They also introduce failures that single-region systems never see, and the hardest of these are the ones that look like partial success.
Why failure modes need their own study
A single-region system mostly fails in a binary way: it is up or it is down. A multi-region system has many more states. One region can be fully down, slow, or reachable from users but cut off from its peers. Each state needs a different response, and a wrong response can turn a small problem into a larger one.
Three categories cover most of what you will meet:
- Regional outages: a whole region, or a critical dependency inside it, stops serving.
- Partial failures: some components, zones, or request paths fail while others keep working.
- Network partitions and split brain: regions are healthy but cannot talk to each other, so each acts on its own.
Regional outages
A regional outage is the failure that active-active is built for. The load balancer or DNS layer detects the failure and routes users to the surviving regions.
The clean case is rare. Real outages often start as degradation: elevated error rates, rising latency, or a failing control plane. A region that is 30% broken is harder to handle than one that is fully down, because health checks may keep marking it healthy and users keep hitting errors.
What to expect during a regional outage:
- Traffic shifts to other regions. Their load rises by the failed region's share, so capacity headroom matters (see the capacity chapter).
- Writes accepted by the failed region but not yet replicated are stranded. With asynchronous replication, the amount of stranded data is bounded by replication lag at the moment of failure. That is your effective RPO.
- Caches in surviving regions are cold for the newly arrived users, so database load spikes.
- When the region returns, it holds stale data and possibly unreplicated writes that must be reconciled.
The last point is often overlooked. Recovery is a second failure event. A region that rejoins without a plan can serve stale reads, or push old writes over newer ones.
Control plane versus data plane
Failover tools often depend on the region that is failing. If your failover requires an API call into the broken region, or a dashboard hosted there, you cannot fail over. Keep the data plane (serving requests) independent of the control plane (changing configuration). Put failover triggers where they work with a region missing, such as health checks run from outside the affected region.
Partial failures
Partial failures are common and difficult to detect. Typical examples:
- One availability zone fails inside a region.
- The web tier is healthy but the database is slow.
- One downstream dependency, such as a payment provider, fails for requests from one region.
- Replication is stalled while the application still serves traffic.
- A "gray failure": the component responds, but slowly or with intermittent errors, so simple up/down checks pass.
The core problem is that different observers disagree. Your health check says the region is fine. Your users say it is broken. A shallow health check that only returns HTTP 200 from the load balancer misses a dead database. A deep check that queries every dependency can instead mark a region unhealthy because of one optional dependency, causing an unnecessary failover.
Guidelines that work well in practice:
- Check what users need. Test the critical path, not every dependency.
- Use timeouts, retries with backoff, and circuit breakers so that a slow dependency does not consume all threads.
- Degrade instead of failing. Serve cached or read-only content when a non-essential dependency is down.
- Measure from the user's side with synthetic probes in addition to server-side checks.
Retry storms
When a region fails, clients retry. If every client retries immediately, the surviving regions receive several times their normal load, which may push them into failure too. This is a cascading failure. Use exponential backoff with jitter, retry budgets, and load shedding so a region protects itself by rejecting excess requests early.
Split brain
Split brain happens when two or more regions each believe they are the authority for the same data or role, and neither can see the other. Both accept writes. When the network heals, the data has diverged.
The cause is usually a network partition, not a region failure. Both regions are up. Users in each region are served normally. Inter-region links are down or heavily congested. From region A, region B looks dead, and from region B, region A looks dead.
This is where the CAP trade-off becomes concrete. During a partition you choose:
- Consistency: refuse writes (or reads) in the side that cannot confirm it has the latest state. Users see errors, but data does not diverge.
- Availability: keep accepting writes on both sides and reconcile later. Users see no errors, but you must resolve conflicts.
Neither choice is free. The choice should be made per data type, not for the whole system. A shopping cart can accept conflicting writes and merge them. A bank balance or a unique username usually cannot.
Preventing split brain
You can prevent it, tolerate it, or detect and repair it.
| Approach | How it works | Cost |
|---|---|---|
| Quorum | A region may act as authority only if it can reach a majority of voters. | The minority side stops accepting some operations. Needs three or more voting locations. |
| Single writer per item | Each record has one home region (write ownership). Others forward writes there. | Writes to items whose home is unreachable fail. |
| Lease or leader election | A leader holds a time-limited lease and must renew it. | Depends on clocks and a reliable coordination service. |
| Conflict-tolerant data | Use last-writer-wins, version vectors, or CRDTs so divergence merges automatically. | Merge rules must match business meaning. Some data loses updates. |
Use an odd number of voters, and place the tie-breaker in a third location, so that no single region failure or partition leaves two equal halves. With only two regions, a quorum system cannot tell "the other region died" from "the link broke". A lightweight witness in a third location solves this.
Fencing stale leaders
A former leader may not know it has been replaced. It was paused, partitioned, or slow, and it wakes up still believing it is in charge. Leases alone do not stop it, because its clock may disagree with others. A fencing token fixes this: each new leader receives a larger number, and the storage layer rejects any write carrying an older number.
class FencedStore:
"""Rejects writes from leaders whose token is older than the newest seen."""
def __init__(self):
self.highest_token = 0
self.data = {}
def write(self, token, key, value):
if token < self.highest_token:
raise PermissionError(f"stale token {token} < {self.highest_token}")
self.highest_token = token
self.data[key] = value
store = FencedStore()
store.write(1, "owner", "us-east-1") # original leader
store.write(2, "owner", "eu-west-1") # new leader after failover
try:
store.write(1, "owner", "us-east-1") # old leader wakes up
except PermissionError as err:
print(err) # stale token 1 < 2The check must happen at the resource being protected, not in the leader. A leader that checks its own lease can still be wrong.
Failover that makes things worse
Automatic failover has its own failure modes:
- Flapping: a region oscillates between healthy and unhealthy, and traffic bounces back and forth. Add hysteresis: require several consecutive failures to mark down and several successes to mark up.
- Premature failback: traffic returns to a recovered region before its data has caught up or its caches are warm. Fail back gradually and only after replication lag is near zero.
- Failover overload: the surviving regions cannot absorb the load.
- Correlated failure: regions share a dependency, such as a global configuration service, a common deployment pipeline, or the same bad release. A faulty deployment pushed to all regions at once is a failure of every region. Roll out changes one region at a time.
Reconciling after a failure
After a partition or outage, you need a defined procedure.
- Confirm the link and the region are stable.
- Let replication drain, and watch the lag metric fall to zero.
- Detect conflicts using version metadata, not by comparing values.
- Apply the merge rule for each data type, and record discarded writes in an audit log so a human can review them.
- Shift traffic back gradually.
Silent loss is the worst outcome. Last-writer-wins discards one side's write without any error, so log what it drops for data that matters.
Summary table of failure types
| Failure | Typical signal | Main risk | Main defense |
|---|---|---|---|
| Regional outage | Errors and timeouts from one region | Lost unreplicated writes, overloaded survivors | Headroom, low replication lag, tested failover |
| Gray failure | Slow or intermittent responses | Health checks pass while users suffer | Deep checks on the critical path, synthetic probes |
| Retry storm | Load spike after a failure | Cascading failure | Backoff with jitter, load shedding |
| Partition | Regions healthy, link down | Split brain, divergent data | Quorum, single writer, fencing, mergeable data |
| Correlated failure | All regions fail together | Total outage | Staged rollouts, independent dependencies |
Exercise
Your system has two regions and uses a health check run from region A to decide whether region B is alive. The link between regions fails, but both regions are serving users. Region A's check marks B dead and promotes A as the only writer, while B keeps accepting writes too. Name the failure, and give two changes that would prevent it.
Show answer
This is split brain, caused by a network partition rather than a real regional outage. Two possible fixes: add a witness or voter in a third location so a region needs a majority to act as writer, and use fencing tokens so the storage layer rejects writes from the older leader. Running health checks from outside both regions, and using single-writer ownership per record, also help.
Exercise
A region has a slow database but its load balancer health check still returns HTTP 200. What is this kind of failure called, and how would you detect it?
Show answer
It is a gray failure. Detect it with a health check that exercises the critical path, such as a lightweight read or write against the database, together with synthetic user probes and latency and error-rate alerts measured from the user's side.