Sub topic 5
MTBF, MTTR, and why recovery speed matters
This chapter assumes you can read short Python snippets and that you know the definition of availability and the nines notation from the earlier chapters. It also assumes you know how a downtime budget follows from a target such as 99.9%. Here the question changes. Instead of asking how much downtime you can afford, you ask what determines how much downtime you get. Two numbers answer that: how often the service fails, and how long each failure lasts.
The two quantities
A service alternates between two states. It is up, then a failure happens, then it is down until someone or something restores it, then it is up again.
- MTBF (mean time between failures) is the average length of time the service works between one failure and the next. Here it is measured from the end of one outage to the start of the next, which is the uptime between failures.
- MTTR (mean time to repair, or recover) is the average length of time from the start of a failure until service is restored.
Both are averages over many events. They describe a long-run pattern, not a promise about the next failure.
The availability formula
Over a long period, a service spends an average of MTBF hours up and then MTTR hours down in each cycle. The fraction of time it is up is:
availability = MTBF / (MTBF + MTTR)The formula needs both quantities in the same unit. It does not matter whether you use hours, minutes, or days, but you cannot mix them.
def availability_from_mtbf(mtbf_hours, mttr_hours):
return mtbf_hours / (mtbf_hours + mttr_hours)
print(availability_from_mtbf(1000, 1)) # about 0.999001
print(availability_from_mtbf(1000, 0.1)) # about 0.9999The first service fails about every 1,000 hours and takes an hour to recover, which gives three nines. The second fails just as often but recovers in six minutes, which gives four nines. Failures did not become rarer. Each one just costs less.
A shortcut for small MTTR
When MTTR is much smaller than MTBF, the denominator is close to MTBF, and the formula simplifies:
unavailability ≈ MTTR / MTBFThis form is useful because it shows that the two quantities trade off symmetrically. Unavailability is proportional to MTTR and inversely proportional to MTBF. You get the same improvement from either of these changes:
- Making failures ten times rarer (MTBF times 10).
- Making recovery ten times faster (MTTR divided by 10).
The table below holds MTBF at 1,000 hours and varies only MTTR.
| MTTR | Availability | Downtime per 30 days |
|---|---|---|
| 10 hours | 99.0099% | about 7.1 hours |
| 1 hour | 99.9001% | about 43 minutes |
| 6 minutes | 99.9900% | about 4.3 minutes |
| 36 seconds | 99.9990% | about 26 seconds |
Each tenfold cut in recovery time buys roughly one more nine.
Why recovery speed is often the better lever
If the two levers are mathematically equivalent, why do experienced teams usually invest in MTTR first? There are three practical reasons.
- Failures cannot be eliminated. Hardware breaks, deployments contain bugs, dependencies misbehave, and operators make mistakes. Raising MTBF means finding and removing causes you may not yet know about. Lowering MTTR works on every failure, including the ones nobody predicted.
- MTBF is hard to measure for high targets. To estimate a 10,000-hour MTBF from observation, you need to watch the system for many multiples of that time. MTTR can be measured from every single incident and improved in weeks.
- Faster change raises failure rates. Shipping more often tends to lower MTBF slightly, because each change is a chance to break something. Teams that can recover in minutes can afford that trade.
What makes up MTTR
MTTR is not just the time spent fixing something. It includes everything between the failure starting and the user being served again:
- Detection: the time until a person or a monitor notices the failure.
- Response: the time until someone acknowledges the alert and starts working.
- Diagnosis: the time to work out what is wrong.
- Mitigation: the time to restore service, which is not always the same as fixing the root cause.
- Verification: the time to confirm that users are being served again.
For a typical one-hour incident, the split might look like this: 10 minutes to detect, 5 to respond, 30 to diagnose, 10 to mitigate, and 5 to verify. Diagnosis is the largest piece, so better dashboards and runbooks would help more than a faster deploy pipeline. Without this breakdown you would not know where to spend effort.
Computing MTBF and MTTR from incident records
In practice you estimate both numbers from your own history. Take an observation window, list the outages inside it, and divide.
from datetime import datetime
FMT = "%Y-%m-%dT%H:%M"
incidents = [
("2026-01-04T02:10", "2026-01-04T02:55"),
("2026-02-11T14:00", "2026-02-11T14:20"),
("2026-03-02T09:30", "2026-03-02T10:25"),
]
window_start = datetime(2026, 1, 1)
window_end = datetime(2026, 4, 1)
window_min = (window_end - window_start).total_seconds() / 60
durations = [
(datetime.strptime(end, FMT) - datetime.strptime(start, FMT)).total_seconds() / 60
for start, end in incidents
]
downtime = sum(durations)
uptime = window_min - downtime
mttr = downtime / len(durations)
mtbf = uptime / len(durations)
print(f"window: {window_min} min")
print(f"MTTR: {mttr} min")
print(f"MTBF: {mtbf} min")
print(f"availability: {uptime / window_min:.6f}")
print(f"formula check: {mtbf / (mtbf + mttr):.6f}")
# window: 129600.0 min
# MTTR: 40.0 min
# MTBF: 43160.0 min
# availability: 0.999074
# formula check: 0.999074Three incidents in 90 days totalled 120 minutes of downtime. That gives a 40-minute MTTR, an MTBF of about 30 days, and availability of 99.9074%. The two availability figures agree because the formula is the same calculation rearranged.
Working backwards from a target
The formula can be solved for either variable. This is how you turn an availability target into an engineering requirement.
def required_mttr(target, mtbf_hours):
return mtbf_hours * (1 - target) / target
def required_mtbf(target, mttr_hours):
return mttr_hours * target / (1 - target)
print(required_mttr(0.999, 1000)) # about 1.001 hours
print(required_mtbf(0.9999, 0.5)) # about 4999.5 hoursThe second line says that if recovery takes 30 minutes, you need a failure only about every 208 days to reach four nines. Seeing that number often prompts a discussion about whether to work on rarer failures or faster recovery.
Common errors
Treating MTBF as a guarantee
An MTBF of 1,000 hours does not mean the service runs for 1,000 hours before failing. Failures can cluster. Two can arrive in one afternoon followed by months of quiet, and the average still comes out the same. The mean says nothing about the spread.
Hiding long outages inside the mean
MTTR has the same problem. Nine incidents of 5 minutes and one of 5 hours give an MTTR of 34.5 minutes, yet the long incident accounts for most of the downtime and most of the user harm. Track percentiles of recovery time (the median and the 90th percentile) alongside the mean. Review the worst incidents individually.
Measuring only the fix
If your incident tool records the time when the ticket was opened rather than when the failure began, MTTR will look better than it was. The detection gap is invisible, and detection is often the cheapest part to improve. Start the clock at the first failed request, not at the first page.
Mixing units
Putting MTBF in days and MTTR in minutes yields an answer that looks plausible and is wrong. Convert both to one unit before dividing.
Applying hardware intuition to software
Component makers publish MTBF figures for disks and power supplies, based on large populations of identical parts. Software failures come from changes, load, and configuration. They are not random wear, so a software MTBF is a property of your release process as much as of your code. Treat it as a measured value for the current period, not a constant.
Using too little data
Three incidents, as in the example above, give a rough estimate. A single extra incident would shift both numbers a lot. State the window and the number of incidents whenever you quote MTBF and MTTR.
Ignoring partial failures
The formula assumes a binary up or down state. A service that is slow, or failing for 5% of users, does not fit neatly. Decide up front what counts as a failure, and use the request-based measurement from an earlier chapter if partial outages dominate.
Limits of the model
The formula describes a single component with independent, repeating failures. Real systems are made of many components, and the next chapters combine them in series and in parallel. The formula also assumes recovery returns the service to its original condition. When recovery needs a human to wake up, MTTR depends on the time of day, and a single average hides that pattern.
Exercise
A service has an MTBF of 500 hours and an MTTR of 2 hours. What is its availability? Then recovery is automated so that MTTR drops to 0.2 hours (12 minutes), with MTBF unchanged. What is the new availability?
Show answer
Before: 500 / (500 + 2) = 500 / 502, about 0.996016, or 99.60%. After: 500 / (500 + 0.2) = 500 / 500.2, about 0.999600, or 99.96%. Cutting MTTR by a factor of ten took the service from roughly two nines to nearly four, with no change in how often it fails.
Exercise
Your team needs 99.95% availability, and incident response realistically takes 30 minutes on average. Roughly how long must the service run between failures, on average, to meet the target?
Show answer
Use MTBF = MTTR × A / (1 − A). With MTTR = 0.5 hours and A = 0.9995, MTBF = 0.5 × 0.9995 / 0.0005 = 999.5 hours, about 41.6 days. If failures happen more often than that, you must shorten recovery or reduce how often failures occur.
Exercise
A team reports an MTTR of 20 minutes, calculated from the moment an engineer acknowledged each page until the fix was deployed. Name two parts of the real outage that this figure leaves out, and say how each would change the availability estimate.
Show answer
It leaves out detection time (from the first failed request until the alert fired) and the time before the engineer acknowledged the page. It also omits verification after the fix. Including these makes true MTTR longer than 20 minutes, so the real availability is lower than the formula suggests when the reported figure is used.