Improving Availability: Removing Single Points of Failure
Overview
Hardware dies, software has bugs and people make mistakes, so failures cannot be avoided. Good availability comes from making sure no single failure can take the whole system down.
This lesson shows how to find weak spots, why redundancy helps (with simple maths), and the two numbers teams track: MTBF and MTTR.
Detailed Notes
What is a single point of failure
A single point of failure (SPOF) is any one component whose failure stops the whole system. One database server, one load balancer, one DNS provider, or even one power supply can be a SPOF. Chains are only as strong as their weakest link.
The problem it solves
If your site depends on one server that fails once a year, your site goes down once a year. Doing more testing on that server will not fix it, because every machine eventually fails. The cure is to have a spare ready to take over.
How it works
Step 1: Find the SPOFs. Trace a request from the user to the data and ask at each step, "if this one thing died, what would happen?"
Step 2: Add redundancy. Run two or more copies of each important part, so one can fail while others keep working. You have already met these tools:
- Several app servers behind a load balancer (Load Balancing chapter).
- Replicas of the database, with a follower taking over if the leader dies (Redundancy and Replication, and Leader and Follower chapters).
- Heartbeats so failures are noticed quickly (Heartbeats chapter).
- Copies spread across different locations so one data centre problem does not take everything down.
The act of switching traffic from a failed component to a healthy one is called failover. The next chapter looks at failover styles in detail.
Step 3: Remember the redundancy of the redundancy. The load balancer that spreads traffic across many servers is now itself a SPOF, so it needs a partner too.
The maths of why it works. Say each server is 99% available.
- Components in a chain (all must work) multiply: two 99% parts give 0.99 x 0.99 = 98%. More parts in a chain means lower availability.
- Components in parallel (any one is enough) fail only if all fail: two 99% servers fail together 1% x 1% = 0.01% of the time, so 99.99% available.
Two numbers teams track:
- MTBF (mean time between failures): how long it typically runs before failing.
- MTTR (mean time to repair): how long it typically takes to recover.
Availability = MTBF / (MTBF + MTTR)
You can improve availability by failing less often (higher MTBF) or, usually more cheaply, by recovering faster (lower MTTR) through monitoring, automatic failover and quick rollbacks.
Resilience patterns such as retries and circuit breakers also help, and are covered later in the course.
A simple example
A hospital has a backup generator. The mains power is the single point of failure, so a second source takes over when it fails. But the generator itself must be tested and maintained, or the "spare" is just a false sense of safety.
System design example
A web app starts as one app server and one database, both SPOFs. To improve it:
- Run three app servers behind a load balancer.
- Add a second load balancer, so the first is no longer a SPOF.
- Give the database a leader plus a follower that is promoted on failure, detected by heartbeats.
- Place these in two separate data centres.
Now any one machine, or even a whole data centre, can fail without users noticing. It costs more and is more complex, so apply it to the paths that really need it.
Summary
- A single point of failure is one component whose failure breaks the whole system.
- Remove it with redundancy: spare copies plus fast failover.
- Parts in a chain lower availability; parts in parallel raise it.
- Availability = MTBF / (MTBF + MTTR); recovering fast matters as much as failing rarely.
Architecture Diagram
Every layer has a spare, so no single failure stops users.
- 1Users reach one of two load balancers.
- 2Servers in two zones share the traffic.
- 3If a zone fails, the other zone keeps serving.
- 4If the database leader fails, the follower takes over.
Common Interview Questions
Chapter quiz
Availability · 5 questions
1.How much downtime per year does 99.99% availability allow?
2.Each additional "nine" of availability roughly means:
3.What is a single point of failure?
4.Two servers, each 99% available, are placed in parallel and either one can serve traffic. Roughly what is the combined availability?
5.Which pair of terms describes how often something fails and how long it takes to fix?
0 of 5 answered
Finished this lesson?
0 of 91 lessons done · 0% of the course

