---
title: Dependability
heading: MTTF, MTTR and availability, failure rates in series, redundancy, nines and RAID
eyebrow: S4 · Lesson 43 · Dependability
xp: 50
---

::: hook
Every component eventually fails: disks, fans, power supplies, memory chips, whole servers. A dependable system keeps working anyway, and designing one starts with a few numbers. How long, on average, until a part fails? How long to repair it? How do failure rates combine when a system needs every part to work, and how much does a spare copy buy when it needs only one? The arithmetic is simple and its consequences are large: two replicas of a 99.9%-available service give 99.9999%, while chaining ten 99.9% components in series gives only 99%.
:::

::: play
- Availability of a service with k independent replicas, each available a fraction a of the time, measured in **nines**: $-\log_{10}(1 - A)$ with $A = 1 - (1 - a)^k$.
- Each replica multiplies the unavailability by $1 - a$: at a = 99.9%, every extra copy adds three nines (if failures really are independent).
- Correlated failures (a shared power feed, the same software bug everywhere) break the independence assumption, which is why real systems spread replicas across racks, buildings and regions.
:::
:::

```sim plot
view: graph
x: k = 1..6 step 1
y: n = 0..20
slider: a = 0.9..0.9999 = 0.999
plot: -log(1 - a)*k | samples: 300 | label: nines of availability
readout: downtime per year with one replica, minutes = (1 - a)*525600
```

::: predict
## A server's parts have MTTFs of 1,000,000 hours (each of two disks), 200,000 hours (power supply), 500,000 hours (motherboard) and 100,000 hours (fan), and the server needs all of them. What's its MTTF?

- [ ] 100,000 hours
- [x] About 53,000 hours
- [ ] About 360,000 hours
- [ ] 1,800,000 hours

::: reveal
Failure rates add when every part is needed: 2/10⁶ + 1/(2 × 10⁵) + 1/(5 × 10⁵) + 1/10⁵ = 1.9 × 10⁻⁵ per hour, so MTTF = 52,600 hours, about 6 years, shorter than the weakest part alone. The fan dominates, and a redundant fan would raise the server's MTTF more than better disks would.
:::
:::

::: nameit
## Measures

- **MTTF** (mean time to failure), **MTTR** (mean time to repair), MTBF = MTTF + MTTR.
- **Availability** $A = \frac{\text{MTTF}}{\text{MTTF} + \text{MTTR}}$, often quoted in nines: 99.99% is "four nines", about 53 minutes of downtime a year.
- **Failure rate** $\lambda = 1/\text{MTTF}$ (assuming a constant rate, the flat middle of the bathtub curve). FIT = failures per $10^9$ device-hours.

## Combining parts

- **Series** (all needed): rates add, $\lambda = \sum\lambda_i$, so $\text{MTTF} = 1/\sum(1/\text{MTTF}_i)$; availability multiplies, $A = \prod A_i$.
- **Parallel** (any one suffices): unavailability multiplies, $A = 1 - \prod(1 - A_i)$.

## RAID

- **RAID 1** mirrors each disk; **RAID 5** spreads one parity block per stripe across N disks and survives any single failure; **RAID 6** survives two.
- Data is lost if a second disk fails during the repair window. For N disks of MTTF M and repair time R, RAID 5's mean time to data loss is about

$$\text{MTTDL} \approx \frac{M^2}{N(N - 1)R}$$

(In practice unrecoverable read errors during rebuild and correlated failures make it much shorter, which is why large arrays use RAID 6 or erasure codes.)
:::

::: example
## For the server above, with a 24-hour repair time, what's the availability and the downtime per year?

::: solution
1. **Availability.** The MTTF is 52,632 hours:
   $$\begin{aligned} A &= 52{,}632/52{,}656 \\ &= 0.99954 \end{aligned}$$
   three nines and a bit.
2. **Downtime.**
   $$\begin{aligned} D &= (1 - A) \times 525{,}600\ \text{min} \\ &= 240\ \text{min} \end{aligned}$$
   a year.
3. **Two servers behind a load balancer.** If they fail independently, the unavailability is
   $$(4.6 \times 10^{-4})^2 = 2.1 \times 10^{-7}$$
   about 7 seconds a year.

**Answer:** the availability is 0.99954, about 240 minutes of downtime a year.
:::
:::

::: example
## A RAID 5 array has 8 disks with an MTTF of 1,000,000 hours and a 24-hour rebuild. What's its MTTDL?

::: solution
1. **MTTDL.**
   $$\frac{(10^6)^2}{8 \times 7 \times 24} = 7.4 \times 10^8\ \text{h}$$
   about 85,000 years.
2. **Compare with one disk.** A single disk's MTTF is 114 years, so parity buys a factor of several hundred.
3. **The catch.** That holds only as long as the second failure really is independent of the first and the rebuild reads every sector cleanly.

**Answer:** the MTTDL is about $7.4 \times 10^8$ hours, roughly 85,000 years.
:::
:::

::: example
## A service needs one load balancer (99.99% available) in series with a pair of replicated servers, each 99% available, either of which can carry the load. What is its availability, and its downtime per year?

::: solution
1. **The pair.** It's unavailable only when both servers are:
   $$1 - 0.01^2 = 0.9999$$
2. **In series with the balancer.**
   $$0.9999 \times 0.9999 = 0.9998$$
   about 105 minutes of downtime a year.
3. **The weak link.** Replicating the servers turned two nines into four, and the balancer is now as weak a link as they are.

**Answer:** the service is 0.9998 available, about 105 minutes of downtime a year.
:::
:::

::: check
given: M = 5000 | 50000 | 500000; R = 2 | 24 | 72
answer: 1e6*R/(M + R)
unit: ppm
tolerance: 0.5%

## A component has an MTTF of {M} hours and takes {R} hours to repair. What's its unavailability, in parts per million?

::: right
Right. $1 - \frac{\text{MTTF}}{\text{MTTF} + \text{MTTR}} = \frac{\text{MTTR}}{\text{MTTF} + \text{MTTR}}$ = {answer} ppm.
:::

::: misses
- [1e6*M/(M + R)] That's the availability; the question asks for the time it's down.
- [any] Not yet. Down time over total time.
:::
:::

::: check
given: a = 100000 | 300000; b = 500000 | 1000000; c = 50000 | 200000
answer: 1/(1/a + 1/b + 1/c)
unit: h
tolerance: 0.5%

## A system needs three parts with MTTFs of {a}, {b} and {c} hours. What's its MTTF?

::: right
Right. $1/\sum(1/\text{MTTF}_i)$ = {answer} hours.
:::

::: misses
- [(a + b + c)/3] Failure rates add, not MTTFs.
- [any] Not yet. Add the failure rates and invert.
:::
:::

::: check
given: a = 0.99 | 0.999 | 0.9999; k = 2 | 3
answer: -log(1 - a)*k
tolerance: 0.5%

## A service runs {k} independent replicas, each available {a} of the time. How many nines of availability does it have?

::: right
Right. $-\log_{10}(1 - a)^k$ = {answer} nines.
:::

::: misses
- [-log(1 - a)] Each replica multiplies the unavailability.
- [any] Not yet. Unavailability is $(1 - a)^k$.
:::
:::

::: check
given: A = 0.99 | 0.995 | 0.999 | 0.9995
answer: (1 - A)*525600
unit: min
tolerance: 0.5%

## A service is available {A} of the time. How many minutes of downtime is that per year?

::: right
Right. {answer} minutes.
:::

::: misses
- [(1 - A)*8760] That's hours; convert to minutes.
- [any] Not yet. Unavailability × minutes in a year.
:::
:::

::: check
given: N = 4 | 8 | 12; M = 500000 | 1500000; R = 12 | 48
answer: M^2/(N*(N - 1)*R)/8766
unit: yr
tolerance: 0.5%

## A RAID 5 array of {N} disks has an MTTF of {M} hours per disk and a {R}-hour rebuild. What's its MTTDL, in years?

::: right
Right. $\frac{M^2}{N(N - 1)R}$ = {answer} years.
:::

::: misses
- [M^2/(N*N*R)/8766] After one failure, only N − 1 disks can fail.
- [any] Not yet. Rate of a first failure, times the chance of a second during repair.
:::
:::

::: check
given: n = 5 | 10 | 20; a = 0.999 | 0.9999
answer: 100*(1 - a^n)
unit: %
tolerance: 0.5%

## A request passes through {n} components in series, each available {a} of the time. What's the end-to-end unavailability?

::: right
Right. $1 - a^n$ = {answer}%.
:::

::: misses
- [100*(1 - a)] Each component must be up: availabilities multiply.
- [any] Not yet. One minus the product of the availabilities.
:::
:::

::: check
kind: parts
given: M = 1000 | 10000 | 100000; R = 1 | 8 | 24

## A system has an MTTF of {M} hours and a repair time of {R} hours.

::: part
answer: R/(M + R)*100
unit: %
tolerance: 0.5%

### What is its unavailability, one minus the availability?

::: misses
- [any] $\text{MTTR}/(\text{MTTF} + \text{MTTR})$.
:::
:::

::: part
answer: R/(M + R)*525960
unit: minutes
tolerance: 0.5%

### How much downtime does it have per year?

::: misses
- [any] Unavailability × minutes in a year.
:::
:::
:::

::: check
kind: parts
given: M = 100000 | 1000000; N = 4 | 8 | 12; R = 10 | 48

## A RAID 5 array has {N} disks with an MTTF of {M} hours and a {R}-hour rebuild.

::: part
answer: M^2/(N*(N - 1)*R)/8760
unit: years
tolerance: 0.5%

### What is its mean time to data loss?

::: misses
- [M^2/(N*R)/8760] After one failure, any of the other N − 1 can end it.
- [any] $M^2/(N(N - 1)R)$.
:::
:::
:::

::: check
kind: derivation
vars: a = 100..100000, b = 100..100000, p = 0.9..0.9999, q = 0.9..0.9999

## Two parts have MTTFs a and b, and availabilities p and q.

::: step
answer: 1/(1/a + 1/b)

### What is the MTTF of the pair in series?
:::

::: step
answer: p*q

### What is their availability in series?
:::

::: step
answer: 1 - (1 - p)*(1 - q)

### And in parallel?
:::

::: right
Right. Series multiplies availabilities; parallel multiplies unavailabilities.
:::
:::

::: explain
## Why does redundancy improve availability so dramatically, and what limits it in practice?

::: model
With independent replicas, the service is down only when all of them are down at once. If each is unavailable a small fraction of the time, the chance that all are down together is that fraction raised to the number of replicas, so each extra replica multiplies the downtime by a small number, adding several nines. The catch is independence. Replicas that share a power supply, a network switch, a building, a software version or a configuration change can fail together, and then the downtime is set by that shared cause, not by the product. Real systems gain most of redundancy's benefit only by separating replicas in every way they can, and by repairing failures quickly so the window for a second failure stays short.
:::
:::

::: practice

::: check
given: M = 20000 | 300000; R = 4 | 36
answer: 1e6*R/(M + R)
unit: ppm
tolerance: 0.5%

## Unavailability in ppm: MTTF {M} h, MTTR {R} h?

::: misses
- [any] MTTR/(MTTF + MTTR).
:::
:::

::: check
given: a = 200000 | 800000; b = 60000 | 150000
answer: 1/(1/a + 1/b)
unit: h
tolerance: 0.5%

## Series MTTF: {a} h and {b} h?

::: misses
- [any] Add rates, invert.
:::
:::

::: check
given: A = 0.99 | 0.995 | 0.998 | 0.999 | 0.9995 | 0.9999
answer: (1 - A)*525600
unit: min
tolerance: 0.5%

## Downtime per year at {A}?

::: misses
- [any] $(1 - A) \times 525{,}600$.
:::
:::
:::
