Defining high availability
easy 25 minAvailability is the share of time, or of requests, that a system works for its users.
Video lesson · Chapter 1 of 6
What one more nine buys
The nines in 80 seconds
1:20Reel coming soon
Theory
Read or listen first. About 2 min.
What it is
Availability is the share of time that a system can do its job for its users. If a shop website works for 999 hours out of 1,000, its availability is 99.9%.
High availability (HA) is a design goal: the system keeps working for an agreed, very high share of the time, even when parts of it break. It is always a number with a period. "Always up" is a wish, "99.9% of requests in a month" is a target.
Why it exists
Every machine, cable and program fails sometimes, and people change software every week. Without a target nobody can say whether one broken evening a month is fine or a disaster.
A number settles that. It tells engineers how much spare equipment to buy, tells the business what a promise may cost, and tells everybody when to stop shipping features and fix things. Each extra nine is ten times harder to keep, so the right target is the lowest one your users are happy with.
A short history
1976
The first Tandem/16, sold as NonStop, ships to Citibank. It is built from duplicated parts so that one failure does not stop work.
1985
Jim Gray publishes "Why Do Computers Stop and What Can Be Done About It?", which shows that administration and software, not only hardware, cause outages.
2008
Amazon EC2 leaves beta and adds a service level agreement. Availability becomes something you buy with a refund attached.
2016
Google publishes the book Site Reliability Engineering. Service level objectives and error budgets become common words.
Words to know
- Uptime
- Time when the system works and serves users.
- Downtime
- Time when users see errors or cannot reach it.
- Nines
- How many nines the percentage has. 99.99% is four nines.
- MTBF
- Mean time between failures: how long it runs, on average, before something breaks.
- MTTR
- Mean time to recovery: how long a break lasts, on average.
- SLI
- Service level indicator: what you measure.
- SLO
- Service level objective: the target you set for yourself.
- SLA
- Service level agreement: the promise in a contract, with a penalty.
- Error budget
- The downtime or failed requests the SLO still allows.
How it works
Step through the idea, or press Play.
Pick a target. How many nines the users need, for which requests, over which period
Understand it
Start here
The ice cream shop
Imagine you have a favourite ice cream shop. You love it, but sometimes you walk there and it is closed. How often it is closed over a whole year is its availability. A shop with five nines is almost never closed: about 5 minutes in a year.
Nobody asks whether the shop is ever closed. They ask how long, and whether it was closed when they came.
The formula
How availability is worked out
Availability over time
Uptime
Time when the system works and serves users. The good time.
Downtime
Time when users see errors or cannot get in. The bad time.
Availability %
The score. Higher is better, and more expensive.
With high availability
- A server crashes on the biggest sale day
- A spare takes over within seconds
- Most customers never notice
Without it
- The same server crashes
- The shop shows errors until someone repairs it
- Customers buy somewhere else
The nines
How much downtime does a target allow?
We count how many nines are in the percentage. Every extra nine leaves ten times less downtime.
Allowed downtime
| Nines | Availability | Per year (365 days) | Per month (30 days) | Where you might see it |
|---|---|---|---|---|
| 2 | 99% | 3.65 days | 7.2 hours | Internal tools, batch jobs |
| 3 | 99.9% | 8.76 hours | 43.2 min | Business apps |
| 3 and a half | 99.95% | 4.38 hours | 21.6 min | Managed databases |
| 4 | 99.99% | 52.6 min | 4.3 min | Large shops, payment pages |
| 5 | 99.999% | 5.3 min | 25.9 s | Core payment and telephone systems |
| 6 | 99.9999% | 31.5 s | 2.6 s | Very rarely promised |
The 10x rule
Measuring
MTBF and MTTR
Two averages explain every availability number: how often it breaks, and how long each break lasts.
A system's life
A worked month: 720 hours, 3 failures, 90 minutes down
| Metric | Meaning | Calculation | Result | Better is |
|---|---|---|---|---|
| MTBF | Mean time between failures | (720 h - 1.5 h) / 3 | 239.5 h | Higher |
| MTTR | Mean time to recovery | 90 min / 3 | 30 min | Lower |
| Availability | MTBF / (MTBF + MTTR) | 239.5 / 240 | 99.79% | Higher |
Two levers
Raise MTBF: fail less often
- Better tests and code quality
- Redundant parts
- Proactive monitoring and alerts
- Capacity planning
Lower MTTR: recover faster
- Automatic failover
- Runbooks and playbooks
- On-call people and clear escalation
- Fast rollback
Chains
Parts in a row multiply
A request usually needs several parts, and it fails if any of them fails. So their availabilities multiply, and the result is lower than the worst part.
One of each: three things that can stop you
Availability of a chain
The same chain with spares
Hard or soft dependency?
Time or requests
Two ways to count
| Time-based | Request-based | |
|---|---|---|
| Formula | Up minutes / all minutes | Good requests / all requests |
| Good for | One system that is up or down | Anything that can be partly broken |
| 20 minutes down at 4 am | Costs 20 minutes | Costs little: few requests |
| 5% errors for 2 hours | Up or down? Unclear | Like 6 minutes of full outage |
| Needs | A rule for what counts as down | A count from the load balancer or the client |
Promises
SLI, SLO and SLA
Three names, one order: measure, target, promise.
| Full name | What it is | Example | |
|---|---|---|---|
| SLI | Service level indicator | What you really measure | Good requests this month: 99.97% |
| SLO | Service level objective | Your own target, stricter than the SLA | 99.95% of requests a month |
| SLA | Service level agreement | A contract with customers; breaking it costs credits or penalties | 99.9%, or part of the bill is returned |
How they work together
A real contract: the Amazon EC2 region SLA promises 99.99% a month. Below that, credits are 10% of the bill, below 99.0% 30%, below 95.0% 100%. A single instance is only promised 99.5%. Credits are small compared with what an outage costs you, so an SLA is not a plan.
Error budget
Spending the downtime you are allowed
If the SLO is 99.95%, then 0.05% may fail. That is the error budget: 21.6 minutes in a 30-day month. Releases, experiments and maintenance all spend it.
What to do with the budget
Burn rate
Do not mix up
Four words that are not the same
| Word | Question it answers | Example |
|---|---|---|
| Availability | Can I use it now? | The photo opens |
| Durability | Is my data still there? | The photo was not lost |
| Reliability | Does it do the right thing over time? | It opens the right photo, every day |
| Fault tolerance | Does a failure show at all? | A disk died and nobody noticed |
Money
What a nine is worth
A worked decision (assumed numbers)
- 1
Sales per minute
A shop sells 12,000,000 / 525,600 = about 68 at a peak of 3x.
- 2
Downtime saved by one nine
From 99.9% to 99.99%: 8.76 h - 0.88 h = 7.88 h, about 473 minutes a year.
- 3
Value of that nine
473 x 10,900 a year in direct sales.
- 4
Decide
If a second region costs $60,000 a year, it does not pay for itself on sales. Trust, contracts and safety can still justify it, but say that aloud.
What five nines asks for
Several data centers
Spares of everything, in places that do not fail together.
Failover in seconds
5.3 minutes a year leaves no room for a human repair.
People on call
Engineers day and night, for what automation does not know.
Live monitoring
Real-time measurements and alerts on what users feel.
Chaos engineering
Break parts on purpose, so that the first failover is not the real one.
Tests and runbooks
Every release is tested and every known failure has written steps.
Summary
The whole topic in one minute.
Availability is good time divided by total time, or good requests divided by all requests. Counting nines is a short way to say it: each extra nine cuts the allowed downtime by ten.
Two levers move it: fail less often (MTBF up) or recover faster (MTTR down). Parts in a chain multiply, so a system is worse than its weakest part. Measure an SLI, hold it to an SLO, promise a looser SLA, and spend the gap, the error budget, on change.
- Availability is uptime over total time, or good requests over all requests.
- 99.9% is 43.2 minutes a month, 99.99% is 4.3. Each nine is 10x less.
- A = MTBF / (MTBF + MTTR): fail less, or recover faster.
- Parts in a row multiply. Three at about 99.95% give about 99.9%.
- SLI is measured, SLO is the target, SLA is the promise. The error budget is what the SLO leaves.