Sub topic 8
How dependencies in series lower availability
What this chapter covers
This chapter explains why a service that depends on several components is less available than any one of them. It shows how to compute the combined availability, how to find the weakest link, and where the simple formula stops being accurate.
It assumes you know the following:
- Availability is the fraction of time (or requests) in which a service works correctly.
- A target such as 99.9% ("three nines") converts into a downtime budget, which is the amount of downtime the target allows.
- You can read short Python snippets and multiply probabilities.
The series rule
A request often passes through many components. A typical web request might touch a load balancer, an application server, a cache, a database, and an authentication service. If the request needs every one of them to succeed, the components are in series. If any one is down, the request fails.
For components that fail independently, the availability of the whole chain is the product of the individual availabilities:
A_total = A1 × A2 × ... × An
Each factor is at most 1, so the product can never be higher than the smallest factor. Every extra hard dependency lowers the total or leaves it unchanged.
from math import prod
def series(*availabilities):
return prod(availabilities)
print(series(0.999, 0.999, 0.999)) # about 0.997003, roughly 99.70%Three components at 99.9% each give about 99.70%. The chain has lost roughly two thirds of a nine compared with any single part.
Why the loss is close to additive
For high availabilities, you can use an approximation. Write each component's unavailability as u = 1 − A. When every u is small, the product is close to 1 minus the sum of the unavailabilities:
A_total ≈ 1 − (u1 + u2 + ... + un)
The approximation works because the cross terms, such as u1 × u2, are tiny. For three components at 99.9%, each u is 0.001, so the sum is 0.003 and the estimate is 0.997. The exact answer is 0.997003.
This gives a useful rule of thumb. In a serial chain, the downtime budgets add up. If each of three components is allowed 43.2 minutes of downtime per 30 days, the chain as a whole can lose about 129.6 minutes.
The following code compares the exact value with the approximation and converts the result into downtime.
from math import prod
def series(*availabilities):
return prod(availabilities)
def series_approx(*availabilities):
return 1 - sum(1 - a for a in availabilities)
def downtime_minutes(availability, period_days=30):
return (1 - availability) * period_days * 24 * 60
parts = (0.999, 0.999, 0.999)
exact = series(*parts)
approx = series_approx(*parts)
print(f"exact: {exact:.6f} -> {downtime_minutes(exact):.2f} min per 30 days")
print(f"approx: {approx:.6f} -> {downtime_minutes(approx):.2f} min per 30 days")The output is:
exact: 0.997003 -> 129.47 min per 30 days
approx: 0.997000 -> 129.60 min per 30 daysThe two results differ by a fraction of a minute. The approximation gets worse when components are much less available, for example when several parts sit at 90%.
A worked example
Suppose a checkout service has these hard dependencies. "Hard" means that if the dependency fails, checkout fails.
| Component | Availability |
|---|---|
| Load balancer | 99.99% |
| Application servers | 99.95% |
| Session cache | 99.9% |
| Primary database | 99.95% |
| Payment provider | 99.9% |
The unavailabilities are 0.0001, 0.0005, 0.001, 0.0005, and 0.001. They sum to 0.0031, so the chain is available about 99.69% of the time. That is roughly 134 minutes of downtime per 30 days.
Look at where the loss comes from. The session cache and the payment provider together contribute 0.002 of the 0.0031 total, which is about 65%. The load balancer, the best component, contributes about 3%. Improving the load balancer from 99.99% to 99.999% would barely change the result. Improving the cache would help far more.
This is the main design lesson of series chains: the weakest links dominate, so improve them first.
components = {
"load balancer": 0.9999,
"app servers": 0.9995,
"session cache": 0.999,
"primary database": 0.9995,
"payment provider": 0.999,
}
total_unavailability = sum(1 - a for a in components.values())
for name, a in sorted(components.items(), key=lambda kv: kv[1]):
share = (1 - a) / total_unavailability
print(f"{name:18s} {a:.4%} contributes {share:.0%} of expected downtime")Running it prints the components from least to most available, along with each one's share of the expected downtime. The two components at 99.9% account for about 65% between them.
Series chains cannot beat their weakest link
Two consequences follow from the formula.
- The chain is never better than its worst component. If your service promises 99.99% but depends on a provider that offers 99.9%, you cannot meet the promise by engineering alone, unless you remove or soften that dependency.
- Adding dependencies has a cost. Each new hard dependency subtracts from your budget, even if it is individually very reliable. A service with 20 dependencies at 99.99% each has an availability of about 99.80%, which is about 86 minutes of downtime per 30 days.
The second point is why architectures with many microservices need care. A request that fans out to dozens of services in series can have lower availability than any single service suggests.
from math import prod
for n in (1, 5, 10, 20, 50):
a = 0.9999 ** n
minutes = (1 - a) * 30 * 24 * 60
print(f"{n:3d} dependencies at 99.99%: {a:.4%} ({minutes:.1f} min per 30 days)")The loss grows nearly linearly with the number of dependencies. Fifty dependencies at four nines drop the chain to about 99.50%, which is below three nines.
What counts as a hard dependency
The series formula applies only to dependencies the request truly needs. Before you multiply, decide which edges are hard.
- A hard dependency causes the request to fail when it fails. The primary database for a write is usually hard.
- A soft dependency can fail without failing the request. A recommendation widget that the page can omit is soft.
Turning a hard dependency into a soft one removes its factor from the product. Common techniques include serving stale cached data, using a default value, skipping an optional feature, or queueing work for later. These are covered in the design patterns chapter. For now, note that the code and diagram of your dependency graph is where this analysis starts.
A related point: the same component can be hard for one operation and soft for another. A product page might need the catalog database to render, but not the review service. Compute availability per user operation, not for the whole system at once.
Where the formula is wrong
The product rule gives a clean number, but it rests on assumptions. Know them before you quote the result.
Failures may not be independent
The formula assumes that one component failing says nothing about the others. In practice, components share power, networks, deployments, and operators. If a bad configuration push takes down two of your components together, the real unavailability is lower than the formula predicts for series chains in some cases, and the failures overlap rather than add. Overlapping outages mean the chain loses less time than the sum of the parts, because the downtime periods coincide.
This is the reverse of the problem for redundant systems. For parallel components, correlated failures make the result worse than the formula says. For serial chains, they make it slightly better. A later chapter covers correlated failures and failure domains.
Availability numbers hide how outages are spread
Two chains can have the same availability and feel very different. One component that fails for 60 minutes once a month and another that fails for one minute sixty times a month both give about 60 minutes of downtime. Users and retries behave differently in the two cases. The product tells you the expected fraction of failure, not the shape.
Component numbers are often not what you experience
A vendor's published availability may be measured differently from yours: monthly versus yearly, excluding maintenance, or counting only full outages. A provider that advertises 99.9% might credit you only after you file a claim. Treat published numbers as upper bounds for planning, and measure the dependency from your own side.
Retries and timeouts change the picture
If a client retries a failed call, a transient failure of a dependency may not fail the request. That raises the effective availability of that edge. On the other hand, slow dependencies can exhaust threads and connections, so a dependency that is merely slow can take down callers that never see an error. Latency failures count as unavailability if users or the SLO treat them that way.
Budgeting backwards from a target
You can also use the series rule in reverse. If the whole service needs availability A_target and has n hard dependencies of similar quality, each one needs about:
Aeach = Atarget^(1/n)
For a 99.9% target with 5 equal dependencies, each needs about 99.98%. For a 99.99% target with 10 dependencies, each needs about 99.999%. The more dependencies, the tighter the requirement on each.
def required_each(target, n):
return target ** (1 / n)
for target, n in ((0.999, 5), (0.9999, 10), (0.9999, 20)):
print(f"target {target:.2%} with {n} parts -> each {required_each(target, n):.5%}")A practical rule is to give your own code a budget and require dependencies to be at least one nine better than your overall target. If your service targets 99.9%, aim for dependencies at 99.99% where you control them. Where you cannot, such as a third-party provider at 99.9%, accept that this dependency alone uses your whole budget, and decide whether to degrade gracefully instead.
Common mistakes
- Multiplying the wrong things. Include only hard dependencies for the operation being measured.
- Forgetting your own service. Your application is also a link in the chain. Its availability belongs in the product.
- Forgetting shared infrastructure. DNS, certificates, identity, and the network are dependencies even when nobody lists them.
- Trusting round numbers. A 99.9% claim in a contract is a ceiling, not a measurement.
- Mixing time-based and request-based figures. Choose one measurement approach before you combine numbers.
- Treating the product as exact. It is a planning estimate that assumes independence.
Summary of the model
| Idea | Rule |
|---|---|
| Serial availability | Multiply the availabilities |
| Quick estimate | Add the unavailabilities and subtract from 1 |
| Downtime | Budgets of serial components add up |
| Upper bound | The chain is never better than its weakest component |
| Fix order | Improve the largest contributor to unavailability first |
| Soft dependencies | Removing a hard dependency removes its factor |
Exercise
A service has four hard dependencies in series, with availabilities 99.99%, 99.95%, 99.9%, and 99.9%. (a) What is the approximate overall availability, using the sum-of-unavailabilities estimate? (b) Roughly how many minutes of downtime per 30 days does that allow? (c) Which dependency should you improve first, and why?
Show answer
(a) The unavailabilities are 0.0001, 0.0005, 0.001, and 0.001, which sum to 0.0026. The estimate is 1 − 0.0026 = 0.9974, or about 99.74%. The exact product is about 0.997402, so the estimate is very close. (b) 0.0026 × 43,200 minutes in 30 days is about 112 minutes. (c) Improve one of the two 99.9% dependencies first. Each contributes 0.001 of the 0.0026 total, about 38% each, so together they make up over three quarters of the expected downtime. The 99.99% component contributes only about 4%.
Exercise
Your service must reach 99.95% availability. It has 8 hard dependencies of equal quality. What availability must each one provide, approximately? Write one line of Python that computes it.
Show answer
Each needs 0.9995^(1/8), which is about 0.99993, or 99.993%. In Python: print(0.9995 ** (1 / 8)). The result is about 0.9999375. This is close to the shortcut of dividing the allowed unavailability (0.0005) by 8, which gives 0.0000625 per component.