Sub topic 9
How redundancy in parallel raises availability
This chapter assumes you know what availability is, how the nines map to downtime, and how components in series multiply their availabilities. It also assumes you can read short Python snippets. The chapter explains the parallel formula, shows where it holds and where it breaks, and gives the common errors.
The core idea
A serial chain fails when any one part fails. A parallel group fails only when every copy fails at the same moment. If one server is down but a second identical server can take over, users see no outage.
Suppose a component has availability a. Its unavailability is 1 - a. With n independent copies, any one of which can handle the whole load, the group is down only if all n copies are down:
A_parallel = 1 - (1 - a1) × (1 - a2) × ... × (1 - an)Compare this with the series rule from the previous chapter. Series multiplies availabilities. Parallel multiplies unavailabilities. That is the whole formula.
Computing it
from math import prod
def series(*availabilities):
return prod(availabilities)
def parallel(*availabilities):
return 1 - prod(1 - a for a in availabilities)
print(series(0.999, 0.999, 0.999)) # about 0.997003, roughly 99.70%
print(parallel(0.999, 0.999)) # about 0.999999, roughly 99.9999%Two servers at 99.9% each give about 99.9999%. Each server has an unavailability of 0.001. Two independent servers are both down with probability 0.001 × 0.001 = 0.000001. Adding the second copy added three nines.
Each copy adds nines
Because the unavailabilities multiply, each added copy of a 99.9% component multiplies the group's unavailability by another 0.001. The table shows the pattern for identical 99.9% copies.
| Copies | Group unavailability | Group availability | Downtime per 30 days |
|---|---|---|---|
| 1 | 0.001 | 99.9% | 43.2 minutes |
| 2 | 0.000001 | 99.9999% | about 2.6 seconds |
| 3 | 0.000000001 | 99.9999999% | about 2.6 milliseconds |
The numbers look wonderful. They are also misleading, for reasons covered below. The table is an upper bound, not a prediction.
You can reproduce the table with the helper from the first chapter's budget calculation:
from math import prod
def parallel(*availabilities):
return 1 - prod(1 - a for a in availabilities)
def downtime_seconds(availability, period_days=30):
return (1 - availability) * period_days * 24 * 3600
for copies in (1, 2, 3):
a = parallel(*([0.999] * copies))
print(f"{copies} copies: {a:.9%} {downtime_seconds(a):.4f} s per 30 days")Mixing series and parallel
Real systems combine both. The usual method is to collapse each parallel group into a single equivalent component, then multiply the results in series.
Consider a web tier of two servers, each 99.9% available, in front of a database that is 99.95% available. A load balancer at 99.99% sits in front of the web tier.
from math import prod
def series(*a):
return prod(a)
def parallel(*a):
return 1 - prod(1 - x for x in a)
load_balancer = 0.9999
web_tier = parallel(0.999, 0.999)
database = 0.9995
system = series(load_balancer, web_tier, database)
print(f"web tier: {web_tier:.6%}")
print(f"system: {system:.4%}")The web tier reaches about 99.9999%, but the system lands near 99.94%. The load balancer and database are single points of failure, so they set the ceiling. Redundancy in one layer cannot lift availability above the weakest unreplicated layer.
The diagram shows why the system figure barely improves when you add a third web server. The remaining unavailability comes from the load balancer and the database, so the next improvement must go there.
Where the formula assumes too much
The parallel formula rests on three assumptions. Each can fail in practice.
Independence
The formula multiplies unavailabilities, which is only valid if failures are independent. If two servers share a power feed, a rack switch, a deployment pipeline, or a software bug, they tend to fail together. Then the probability that both are down is much closer to the probability that one is down than to its square.
A simple way to see the effect is to model a shared dependency in series with the redundant pair:
from math import prod
def series(*a):
return prod(a)
def parallel(*a):
return 1 - prod(1 - x for x in a)
servers = parallel(0.999, 0.999) # ideal: 99.9999%
shared_power = 0.9995 # one feed for both servers
actual = series(shared_power, servers)
print(f"ideal pair: {servers:.6%}")
print(f"with shared feed: {actual:.4%}")The pair drops from about 99.9999% to about 99.95%. The shared feed is now the bottleneck, and the second server bought almost nothing beyond what the feed allows. The next chapter covers failure domains in detail. For now, treat any parallel calculation as a ceiling that shared dependencies push down.
Perfect failover
The formula assumes that when one copy fails, the other takes over instantly and completely. Real failover has costs:
- Detection takes time. A health check that runs every 10 seconds and needs three failures marks a dead server only after about 30 seconds. Requests sent to it in that window fail.
- Switching takes time. A database replica may need to be promoted, caches warmed, or connections re-established.
- The failover mechanism can itself fail. A load balancer, a leader-election service, or a DNS update is a new component in series with the redundant group.
You can fold failover time into the model. If each failure of the active copy causes f hours of disruption before the standby takes over, the extra downtime is roughly the failure rate times f.
def failover_downtime_hours(mtbf_hours, failover_hours, period_hours=720):
expected_failures = period_hours / mtbf_hours
return expected_failures * failover_hours
# Active server fails about once per 1000 hours; failover takes 30 seconds.
extra = failover_downtime_hours(1000, 30 / 3600)
print(f"{extra * 3600:.1f} seconds of failover downtime per 30 days")This prints about 21.6 seconds. That is far larger than the 2.6 seconds the ideal two-copy formula predicted. Failover time, not the probability that both copies are down, often dominates the real downtime of a redundant pair.
Sufficient capacity
The formula assumes one surviving copy can carry the full load. If two servers each run at 70% utilization, a failure sends 140% of one server's capacity to the survivor. It then becomes overloaded and slow, and the group fails despite having a healthy member. Treat this as a rule: size the group so that the loss of the largest tolerated failure still leaves enough capacity.
This leads to an N+1 or N+2 view. If you need k servers of capacity, you deploy k + 1 to tolerate one failure. The group works as long as at least k of n copies are up. That is a "k out of n" system, and the simple parallel formula is the special case where k = 1.
k-out-of-n availability
When you need at least k of n identical copies working, compute the probability with the binomial distribution. Each copy is up with probability a.
from math import comb
def k_of_n(k, n, a):
return sum(comb(n, i) * a**i * (1 - a)**(n - i) for i in range(k, n + 1))
# Need 3 servers of capacity.
print(k_of_n(3, 3, 0.999)) # no spare: about 0.997003
print(k_of_n(3, 4, 0.999)) # N+1: about 0.999994
print(k_of_n(3, 5, 0.999)) # N+2: about 0.99999999One spare turns 99.70% into about 99.9994%. The second spare helps less in absolute terms, and costs the same as the first. The first redundant unit gives the largest jump in availability per dollar, which is a theme of the final chapter.
Active-active and active-passive
The way copies share work changes how close you get to the formula.
| Pattern | How it works | Strength | Weakness |
|---|---|---|---|
| Active-active | All copies serve traffic at once | No switch needed. A failure only removes capacity. Idle capacity is not wasted. | Needs spare capacity on every node. State must be shared or partitioned. |
| Active-passive (hot standby) | One copy serves traffic. A standby is running and ready. | Simple for stateful systems such as a primary database. | Failover time is real downtime. The standby is rarely exercised, so it may not work when needed. |
| Cold standby | A spare is started only after a failure | Cheapest | Recovery takes minutes or longer, so it behaves more like a repair than redundancy. |
Active-passive systems have a classic hidden failure: the standby has been broken for weeks, and nobody knew because it carried no traffic. Test failover regularly, and monitor the standby's health and replication lag.
Common errors
- Multiplying availabilities in a parallel group. That is the series rule. Parallel multiplies the unavailabilities.
- Treating the result as a promise. Six nines on paper from two servers ignores shared power, shared software, shared configuration, and human error.
- Forgetting the new components. A load balancer, health checker, or replication link introduced to enable redundancy sits in series with the group.
- Counting copies that cannot carry the load. Two undersized servers are not a redundant pair.
- Adding copies where the bottleneck is elsewhere. Replicating an already strong layer does nothing for a weaker single point of failure.
- Ignoring that software bugs are correlated. Two copies of the same code with the same bug fail on the same input at the same time.
Summary of the working model
- Collapse each parallel group with
1 - prod(1 - a). - Multiply the collapsed groups and any single components in series.
- Subtract the cost of failover time.
- Check that surviving copies can carry the full load.
- Treat the result as an optimistic ceiling, then lower it for shared dependencies.
Exercise
A service has a load balancer at 99.99%, three application servers at 99.9% each (any one can carry the full load), and a single database at 99.95%. What is the system availability, to four decimal places in percent? Which component should you improve first?
Show answer
The application tier is parallel: 1 - (0.001)^3 = 0.999999999, about 99.9999999%. The system is series: 0.9999 × 0.999999999 × 0.9995 ≈ 0.99940. That is about 99.9400%. The database is the weakest single component at 99.95%, so improve it first, for example with a replica. A fourth application server would change almost nothing.
Exercise
Two servers at 99.9% each sit behind a health check. Each active-server failure causes 45 seconds of failed requests before traffic shifts. The active server fails about once per 500 hours. Estimate the failover downtime in a 720-hour month, and say whether the ideal parallel formula captures it.
Show answer
Expected failures in 720 hours are 720 / 500 = 1.44. Downtime is 1.44 × 45 = 64.8 seconds per month. The ideal parallel formula predicts only about 2.6 seconds per 30 days, so it does not capture failover time. The failover delay dominates and is about 25 times larger than the ideal figure.
Exercise
You need 4 servers of capacity and each server is 99.9% available. Is it better to run 4 servers, or 5? Write the Python call that gives the availability of the 5-server design.
Show answer
Five servers is better because it tolerates one failure. With four, any single failure drops capacity below what you need, giving about 99.6% availability. Use kofn(4, 5, 0.999), which is about 0.99999. This assumes independent failures and perfect failover.