Course contents · Lesson 11 of 19

Single Points of Failure and How to Remove Them

Scaling and Capacity · Lesson 11 of 19 · 10 min Engineer

Your shop runs three app servers behind a load balancer, so when one crashed last month, nobody noticed. Then on Friday evening the whole site went down for an hour: all three servers saved orders to one database, and its disk filled up. Adding servers had removed one weak spot and left another. This lesson shows how to find single points of failure like that database, how to remove them, and what each fix is worth.

What a single point of failure is

A single point of failure (SPOF) is any component whose failure takes the whole service down, because nothing else can do its job. You met one in lesson 7: a single machine, however large. A component can be a server, a database, a network link, a setting or a person.

A part whose loss only degrades the service, such as an image server, matters less than one that stops payments.

In the before-and-after diagram, notice that the fix is a spare for every box, kept in a separate availability zone (AZ): one or more data centres in a region with their own power, cooling and network. Even the load balancer runs in both zones.

Before and after diagram. Before, in red: users send requests to one app server, which uses one database; both are marked SPOF, so if either fails the shop is down. After, in green: users reach a load balancer that runs in both zones and spreads requests across two app servers, in zone a and zone b. Both use a primary database in zone a, which copies every change to a replica in zone b. Lose any one box and another takes over
The fix is not a stronger box but a second one in another zone.

How to hunt for them

Start by drawing the request path: every box a user's request passes through. For the shop, that is DNS, the load balancer, an app server and the database. Then ask of each box: what if this dies now?

If the service would stop, the box is a SPOF. In the flowchart, notice that it is crossed off only after its failover has been tested, not when the spare is bought.

Flowchart. 1, draw the request path: user, DNS, load balancer, app server, database. 2, pick the next box, starting nearest the user. 3, ask what if it dies: a crash, a full disk or an expiry. Decision: can the service continue? Yes leads back to step 2. No leads to 4, mark it as a SPOF; 5, add redundancy, such as a spare in another zone; 6, test the failover by switching over on purpose, then back to step 2. A side panel lists what is easy to miss: DNS name servers, TLS certificates, a shared database, a single region, one person who knows. Footer: done when every box has a tested spare, or a written reason to accept the risk
A spare you have never switched to does not count yet: the loop ends with a test.

These less obvious boxes are easy to miss:

  • DNS. The Domain Name System, the internet's directory from names to addresses (lesson 5), relies on name servers, the computers that answer lookups for a domain. A domain with only one becomes unreachable when it fails and cached answers expire.
  • Expired certificates. A TLS certificate lets browsers check they are talking to the real site over HTTPS, and it has an end date. Once that passes, browsers show a warning page and most apps refuse to connect. Every copy usually shares one certificate, so spares do not help; automatic renewal and an expiry alert do.
  • A shared database. Services that each look redundant may all depend on one database.
  • A single region. Zones survive a data centre failure, but not a fault in a service every zone in the region uses.
  • One person. If only one engineer knows how to restore the system, their holiday is a risk. Add a second who has practised it, and written steps.

Removing them: redundancy and failover

Redundancy means running more copies of a component than you strictly need, so one can fail without users noticing. Lesson 10 called the simplest form N+1: if N copies can carry the peak, run at least one more. Two servers each busy at 80 percent are not redundant, because the survivor would need 160 percent.

Copies must also fail separately. Two servers in one rack share its power, and two in one zone share its building, so place copies in at least two zones. A second region guards against regional outages, at a much higher cost.

Stateless app servers are interchangeable, so spares are easy. A database holds data, so its spare needs a copy of it: a replica, which receives every change from the primary, as in lesson 7. If the primary dies, a replica can be promoted, made the new primary that accepts writes.

A spare is useless while traffic still goes to the dead copy. Health checks, the load balancer's test requests from lesson 5, take a server out of use after it fails a few in a row. Automatic failover is software that notices a failed component and switches to its spare without waiting for a human, for example by promoting a replica and pointing the app at it. Managed databases such as Amazon RDS in its Multi-AZ setup do this for you.

Failover can cost data. Replicas usually copy changes asynchronously and can lag, so promoting one may lose the last writes the old primary confirmed. Synchronous replication, where the primary waits for the replica before confirming each write, avoids that loss but makes every write slower.

The maths: series versus parallel

A component's availability is the share of time it works. Parts on one request path are in series: a request needs all of them, so you multiply. Two parts at 99 percent give 0.99 × 0.99 = 0.9801, or 98.01 percent, and five parts at 99.9 percent give only about 99.5 percent.

Copies that can each do the whole job are in parallel: the service fails only when all of them are down at once. Each is down 1 percent of the time, so both are down 0.01 × 0.01 = 0.0001 of the time, giving 99.99 percent. The diagram turns both into downtime, using the 30-day budgets from lesson 4.

Two diagrams with the maths beside each. In series, both must work: a request passes through part A at 99 percent, then part B at 99 percent. 0.99 times 0.99 is 98.01 percent, about 14.3 hours down per 30 days, and each part added lowers the total. In parallel, one is enough: the request can go to part A or part B, each 99 percent. 1 minus 0.01 times 0.01 is 99.99 percent, about 4.3 minutes down per 30 days, down only if both are down at once. Footer: only if they fail independently, since one shared power feed breaks both
The same two 99 percent parts give about 14.3 hours of downtime per 30 days in a chain, but about 4.3 minutes side by side.

The parallel sum holds only if the copies fail independently: one failing makes the other no more likely to fail. Copies that share a power feed, a zone or a bad configuration change fail together, which is why zones matter. It also assumes failover works at once and the survivor can carry the full load.

The trade-off: cost, complexity and untested spares

Redundancy is not free. A spare server costs as much as the first, data sent between zones may be billed, and every replica and failover rule is more to set up and watch. Failover software can itself fail, or switch when nothing was wrong.

So spend where your error budget says it matters. A 99.9 percent SLO allows about 43.2 minutes of downtime per 30 days: for example, a box that fails for 5 minutes once a quarter may fit, but one that takes a day to rebuild does not.

Above all, test every failover path. A spare that has never taken traffic may be too small, out of date or missing a setting, and you find out during the outage it was meant to stop. Switch over on purpose, in a quiet hour with people watching; Amazon RDS, for example, can reboot a Multi-AZ database with a forced failover. The later lesson on chaos engineering makes this a habit.

Check yourself

Two app servers behind a load balancer each run at 75 percent of their safe limit at peak. Is that tier free of single points of failure?

No. If one fails, the other must carry 150 percent and overloads. Redundancy needs N+1: enough spare that the survivors can carry the peak.

Two copies of a service, each 99 percent available, sit in parallel in the same rack. Why might the real availability be far below 99.99 percent?

The sum assumes they fail independently. In one rack they share power and network, so one fault takes both down; copies in separate zones fail far more independently.

Your site runs in three availability zones, yet it goes down when its TLS certificate expires. Why did the extra zones not help, and what does?

Every copy uses the same certificate, so all fail at once: more copies do not remove a shared dependency. Automatic renewal and an alert well before the end date do.

Go deeper