Sub topic 10
Correlated failures and failure domains
This chapter assumes you have read the earlier chapters on the nines, on series and parallel availability, and on MTBF and MTTR. You should be comfortable with the formula 1 - (1 - a)(1 - a) for two redundant components and with short Python snippets.
The previous chapter ended with a result that looks too good to be true. Two replicas that are each 99.9% available give a pair that is 99.9999% available. That result rests on one assumption: the replicas fail independently. This chapter covers what happens when they don't, and how to design so that they mostly do.
Independence is an assumption, not a property
The parallel formula multiplies the probability that replica A is down by the probability that replica B is down. That multiplication is only valid if knowing A is down tells you nothing about B. In real systems it often tells you a lot.
Two failures are correlated when they tend to happen together. Correlation usually comes from a shared cause:
- Both replicas run on the same physical host, rack, or power feed.
- Both run the same software version, so one bug crashes both.
- Both depend on the same database, DNS provider, or certificate.
- Both receive the same bad configuration push.
- Both are overloaded by the same traffic spike, or by the retry storm that follows when one of them fails.
When such a cause exists, the system has a common-cause failure: a single event that takes out several components at once. A common-cause failure acts like a component in series with the redundant group. The group can be as redundant as you like, but if everything shares one cause, the system is no more available than that cause.
Failure domains
A failure domain is a set of components that can fail together because they share something. The shared thing might be hardware, a location, a software artifact, or an operational action. Domains nest, and you can draw them as a tree.
A failure at a node takes down everything beneath it. Losing instance A1 affects only A1. Losing Zone A affects A1 and A2. Losing the region affects all four. Putting A1 and A2 in the same zone gives you protection against an instance failure, but none against a zone failure.
Common failure domains, from small to large:
| Failure domain | Typical shared cause | What survives if it fails |
|---|---|---|
| Process | A crash, memory leak, or deadlock | Other processes on the same host |
| Host | Hardware fault, kernel panic, noisy neighbor | Other hosts in the rack |
| Rack | Top-of-rack switch or power distribution unit | Other racks in the data center |
| Availability zone | Power, cooling, or network of one facility | Other zones in the region |
| Region | Regional control plane, large network event | Other regions |
| Software version | A bug present in every copy of a release | Copies running a different version |
| Configuration or deploy | A bad push to every instance | Instances not yet updated |
| Provider or account | Billing lock, credential revocation, vendor outage | Nothing inside that provider or account |
The last rows are easy to forget. Software and operational domains don't appear on a hardware diagram, yet they cause a large share of real outages. Ten replicas in ten zones all fail together if a single deploy pushes a broken configuration to all of them at once.
Modeling a shared domain
The simplest correct model treats the shared domain as a component in series with the redundant group. If both replicas live in one zone, the pair works only when the zone works and at least one replica works.
from math import prod
def series(*availabilities):
return prod(availabilities)
def parallel(*availabilities):
return 1 - prod(1 - a for a in availabilities)
MINUTES_PER_30_DAYS = 30 * 24 * 60
def downtime_minutes(availability):
return (1 - availability) * MINUTES_PER_30_DAYS
replica = 0.999
zone = 0.9995
independent_pair = parallel(replica, replica)
same_zone_pair = series(zone, parallel(replica, replica))
print(f"independent: {independent_pair:.6f}, {downtime_minutes(independent_pair):.2f} min per 30 days")
print(f"same zone: {same_zone_pair:.6f}, {downtime_minutes(same_zone_pair):.2f} min per 30 days")
# independent: 0.999999, 0.04 min per 30 days
# same zone: 0.999499, 21.64 min per 30 daysThe zone's 99.95% caps the whole pair. Adding a third or fourth replica in that zone changes almost nothing, because the term 1 - prod(1 - a ...) is already close to 1 and the zone term dominates. Redundancy inside one domain buys protection only against failures smaller than that domain.
The fix is to spread replicas across domains. Two replicas in two zones, each zone at 99.95%, can be modeled as two branches in parallel, where each branch is a zone in series with its replica:
branch = series(0.9995, 0.999)
two_zone_pair = parallel(branch, branch)
print(f"two zones: {two_zone_pair:.6f}, {downtime_minutes(two_zone_pair):.2f} min per 30 days")
# two zones: 0.999998, 0.07 min per 30 daysHere branch is about 0.9985, so each branch is down about 0.15% of the time, and both being down at once happens about 0.0002% of the time. Putting the replicas in different zones removes the zone term from the series path, and the result is close to the independent ideal.
Partial correlation: the beta-factor model
Real failures are rarely fully independent or fully shared. Some fraction of each replica's downtime comes from causes that hit both replicas, and the rest is private to each. Reliability engineering calls the shared fraction the beta factor.
If a replica's unavailability is u and the beta factor is beta, then:
- A common part,
beta * u, takes down both replicas together. - An independent part,
(1 - beta) * u, hits each replica on its own.
The pair is down when the common cause strikes, or when both independent parts strike at once:
def pair_availability(a, beta):
u = 1 - a
common = beta * u
independent = (1 - beta) * u
return (1 - common) * (1 - independent ** 2)
for beta in (0, 0.01, 0.1, 0.5):
print(f"beta={beta}: {pair_availability(0.999, beta):.6f}")
# beta=0: 0.999999
# beta=0.01: 0.999989
# beta=0.1: 0.999899
# beta=0.5: 0.999500If 10% of failures are shared, the pair drops from six nines to under four. At a beta of 0.5 you have barely more than one replica's worth of benefit beyond the shared part. The beta factor is an estimate, not a measurement you can read off a dashboard. You can approximate it from incident history. For each outage of one replica, ask how often the others were affected within the same window.
Note that this is a model, not a law. Treat the output as a way to see how sensitive your design is to the assumption, not as a prediction.
Hidden correlation
Most correlation that hurts teams was not designed in. It arrives through paths that don't appear on the architecture diagram.
- Shared dependencies. Two services in separate zones both call the same authentication service. When it fails, both fail. This is a series dependency that sits outside the replica group.
- Control plane coupling. The data path may be redundant while the system that launches replacement instances, issues tokens, or serves configuration is not. Failures in the control plane often show up only when you need to recover.
- Synchronized load. When one replica fails, its traffic moves to the others. If each was running at 70% capacity, the survivor now receives 140% and fails too. This is a cascading failure, and capacity planning is part of availability for that reason. With N replicas that must absorb the loss of one, each should run at no more than
(N - 1) / Nof its capacity. - Retry amplification. Clients that retry immediately and without backoff multiply load on a struggling service, which turns a partial failure into a full one.
- Same-time events. Certificates that expire on the same date, a leap-second bug, or a scheduled job that every instance starts at midnight all create simultaneous failures.
- Shared change. A single deployment pipeline is itself a failure domain. A bad artifact reaches every target it is aimed at.
Reducing correlation
Design for correlation by shrinking and separating failure domains.
- Spread across physical domains. Place replicas in different hosts, racks, and zones. Use regions when the target requires surviving a whole-region event, and accept the extra latency and data-replication cost.
- Limit the blast radius of change. Roll out changes in stages: one instance, then a small percentage, then everything, with automatic rollback on error signals. Staged rollout turns a single global domain into several small ones.
- Cells. Split the service into independent copies, each serving a slice of users. A failure in one cell affects only that slice. A cell-based design caps the damage from any single bug, overload, or bad customer.
- Diversity. Run different software versions, instance types, or even independent implementations where the cost is justified. Diversity reduces the chance that one bug takes out everything, but it raises operational cost.
- Remove shared dependencies from the critical path. Cache credentials, configuration, and DNS answers so a short upstream outage doesn't immediately become yours. Let the data path keep working when the control plane is down.
- Provision headroom. Make sure the remaining replicas can carry the load after a domain is lost. Redundancy without capacity is only a nominal redundancy.
- Test failure of whole domains. Drain a zone or kill a cell on purpose and see what breaks. Untested domain separation tends to have gaps.
Choosing the right domain size
Surviving a bigger domain costs more, so match the design to the failures you need to survive. A rough way to decide:
- List the failure domains your service sits in.
- Estimate how often each fails and how long recovery takes, using the MTBF and MTTR figures from the earlier chapter.
- Compare the resulting downtime against your SLO's budget.
- Pay for protection against the domains that threaten the budget, and accept the rest.
If your SLO allows 43 minutes of downtime a month, surviving a zone failure that happens once a year for two hours is worth the cost, and surviving a regional failure that happens once a decade may not be. This ties directly to the cost chapter that follows: each larger domain you protect against adds replicas, data transfer, and operational complexity.
Exercise
Two replicas each have 99% availability and are placed in the same zone, which itself has 99.9% availability. Treat the zone as a component in series with the replica pair. What is the combined availability of the pair, and what would it be if the zone term were ignored?
Show answer
The pair alone is 1 - (0.01 × 0.01) = 0.9999. With the zone in series, the result is 0.999 × 0.9999 = 0.9989001, or about 99.89%. Ignoring the zone gives 99.99%, so the naive figure overstates availability by about one nine. Placing the replicas in two independent zones would remove the shared zone term and bring the figure back toward the 99.99% range.
Exercise
A service runs on 4 replicas, evenly sharing load, and must keep serving after one replica fails. What is the maximum average utilization per replica in normal operation, and why does this matter for correlated failures?
Show answer
With N = 4, each replica should run at no more than (N - 1) / N = 75% of capacity. If one fails, the other three take on its load and run at 100%. Above 75%, the loss of one replica pushes the survivors past capacity and they begin to fail too, which makes failures correlated through load rather than through a shared component.