A single point of failure (SPOF) is one component that, when it stops working, stops a whole user flow or the whole system, because nothing else can do its job. The component does not have to be a server. It can be a DNS record, a payment gateway, a password vault or one person who holds the only deploy key.
In this article we follow one example the whole way: a pharmacy home-delivery app in Hyderabad. We trace its user flows to find every SPOF, measure how much damage each one does, fix them layer by layer and then prove the fixes with drills. Six runnable programs in Java (with Python and C++ versions) show each step with real numbers.
Key takeaways
Tracing four user flows through the first version of the app found six components that could each stop at least one flow alone: DNS, the load balancer, the database, the SMS provider, the payment gateway and the prescription bucket.
The database alone took down 90% of the traffic; one of the two app servers took down 0%. Count the damage, not the servers.
With one copy of most stages, the order flow was up 99.5482% of the year, about 2,375 minutes of downtime. With redundancy it reached 99.9953%, about 25 minutes.
Two copies are only redundant if they fail independently. Two load balancers in the same zone and rack are one failure waiting to happen.
A database failover took 7 seconds in the simulation. With asynchronous replication it also lost 2 orders that customers had already been told were placed.
A timeout plus a circuit breaker cut the slowest page from 1,530 ms to 235 ms when one optional service went bad.
Some SPOFs are people and processes. Some SPOFs are worth keeping on purpose, as long as the choice is written down.
1. What Is a Single Point of Failure?
Every system is a chain of parts that a request passes through. If each part has a spare, the chain survives one failure. If one part has no spare, that part decides whether the whole chain works. That part is the SPOF.
One database with no spare stops every request, even when the servers in front of it are fine
Two words are worth keeping apart. Redundancy means having a spare that can do the same job. Failover means actually switching to that spare when the main part fails. A spare that nobody can switch to is not redundancy, it is an expensive paperweight.
This topic sits right after reliability in the basics, and it is the practical side of availability: availability is the goal, and removing SPOFs is one of the main ways to reach it.
2. The Pharmacy App We Will Use
Imagine a small team that has just launched a medicine delivery app for Hyderabad. It was built in a hurry, so the first version looks like this: one DNS provider, one load balancer called lb-1, two app servers (app-1 and app-2), one MySQL database db-1, one SMS provider for login codes, one payment gateway and one storage bucket for uploaded prescriptions.
The first version of the app: most stages have exactly one copy
Customers do four things in the app. We call each one a flow, because a flow is what a customer actually experiences as working or broken.
| Flow | What it needs | Share of traffic |
|---|---|---|
| login | DNS, load balancer, an app server, database, SMS provider | 25% |
| order | DNS, load balancer, an app server, database, payment gateway | 35% |
| prescription | DNS, load balancer, an app server, storage bucket | 10% |
| track | DNS, load balancer, an app server, database | 30% |
Notice what the table already hides. The two app servers look like a safe pair, but the load balancer, the database and DNS sit in front of or behind every flow with a single copy.
3. Finding SPOFs: Remove One Part at a Time
The simplest reliable method is to ask, for every component: if only this one disappears, does any flow stop? To answer it in code, describe each flow as a list of stages. A stage lists the components that can do that job, and one of them is enough. A flow breaks when some stage has nothing left.
The order flow as a chain of stages: any stage with one copy is a candidate SPOF
Output
Version 1 (as built)
dns-a breaks 4 of 4 flows: login, order, prescription, track
lb-1 breaks 4 of 4 flows: login, order, prescription, track
db-1 breaks 3 of 4 flows: login, order, track
bucket-1 breaks 1 of 4 flows: prescription
pay-a breaks 1 of 4 flows: order
sms-a breaks 1 of 4 flows: login
Version 2 (after the fixes)
no single component breaks any flow
Dry run. Take dns-a. Every flow has a DNS stage, and in version 1 that stage contains only dns-a. Remove it and the stage is empty, so all four flows break. Now take app-1. The app stage still has app-2, so no flow breaks, and app-1 does not appear in the report at all. The database appears in login, order and track (three flows) but not in prescription, because uploaded prescriptions go straight to the bucket. After the fixes, every stage has two members, and the second report says no single component breaks any flow.
This check is a toy version of what real teams do on a whiteboard, and it has one big limit: it can only find the SPOFs you wrote down. The sections below cover the ones that usually are not on the diagram.
4. Blast Radius: How Bad Is Each Failure?
Not every SPOF is equally urgent. The blast radius of a component is the share of users, requests or money that stop working when it fails. To rank the six SPOFs we weight each flow by its share of traffic and add up the flows that break.
The same kind of failure can cost 90%, 25% or 0% of the traffic
Output
Blast radius of each component (version 1)
dns-a 100% critical
lb-1 100% critical
db-1 90% critical
pay-a 35% partial
sms-a 25% partial
bucket-1 10% partial
app-1 0% no user impact
app-2 0% no user impact
Dry run. db-1 is needed by login (25%), order (35%) and track (30%), so its radius is 25 + 35 + 30 = 90%. sms-a only blocks the login flow, so 25%. pay-a blocks only orders, so 35%, but those are the orders that earn money, so the business may care more than 35% suggests. The two app servers score 0% because the other one can carry the load. The ranking gives a sensible order for the work: DNS, the load balancer and the database first, then the payment gateway, SMS and the bucket.
Radius is only half of the story. Also ask how likely the failure is and how long recovery takes. A rare failure with a one-hour recovery can hurt more than a frequent one that fixes itself in ten seconds.
5. Why Redundancy Works: The Maths of Series and Parallel
When a request must pass through stage after stage, the chance that all of them work is the product of their availabilities. This is the series rule, and it only ever gets worse as you add stages. When a stage has several copies and one is enough, the stage fails only if all copies fail. This is the parallel rule, and it is where redundancy pays off.
Series stages multiply (worse); parallel copies multiply the failure chances (much better)
Output
Order flow, version 1
dns 1 copy 0.999500 262.80 min/year down
lb 1 copy 0.999000 525.60 min/year down
app 2 copies 0.999975 13.14 min/year down
db 1 copy 0.999000 525.60 min/year down
pay 1 copy 0.998000 1051.20 min/year down
WHOLE all in a row 0.995482 2374.60 min/year down
Order flow, version 2
dns 2 copies 1.000000 0.13 min/year down
lb 2 copies 0.999999 0.53 min/year down
app 2 copies 0.999975 13.14 min/year down
db 2 copies 0.999999 0.53 min/year down
pay gateway + cash 0.999980 10.51 min/year down
WHOLE all in a row 0.999953 24.83 min/year down
More copies of the app tier
app 1 copy 0.995000 2628.00 min/year down
app 2 copies 0.999975 13.14 min/year down
app 3 copies 1.000000 0.07 min/year down
Dry run. Version 1 of the order flow multiplies 0.999500 (DNS) by 0.999000 (load balancer), 0.999975 (two app servers), 0.999000 (database) and 0.998000 (payment). The result is 0.995482, or 2,374.60 minutes of downtime a year, about 40 hours. The payment gateway alone is 1,051 of those minutes. After the fixes each stage has two copies, and the flow reaches 0.999953, about 25 minutes a year. The last block shows the pattern behind it: the second app server removes 2,615 minutes of downtime, the third removes only another 13. The second copy is the big win; the third is a luxury.
One warning about those numbers. The parallel rule assumes the copies fail independently. If two servers sit on the same power feed, the rule no longer holds. We come back to this in section 9.
6. Fixing Each Layer
With the ranking in hand, the team fixes the layers in order of blast radius.
DNS: add a second DNS provider, so the app's name still resolves if the first provider has an outage.
Load balancer: run two (
lb-1andlb-2) and let a health check move traffic to the standby when the active one stops answering.App servers: keep them stateless so any server can serve any request (see scalability for why), and let the load balancer drop a server whose health check fails.
Database: add a replica in another zone and a monitor that can promote it (next section).
SMS provider: add a second provider; switching between two is cheap.
Prescription bucket: keep a second bucket, in another region, that receives every upload.
Payment gateway: a second gateway means a second contract and double reconciliation, so the team adds a fallback instead: if the gateway is down, the app offers cash on delivery.
A standby load balancer takes over when the active one misses its heartbeats
More generally, a load balancer or health check that is itself a single copy only moves the SPOF up one level. Our load balancing lessons show how a pair is usually built.
7. Failover: Promoting the Database Replica
A second database only helps if something notices the first one died and promotes the second. A heartbeat is a small message the primary sends every second. A monitor that misses three in a row declares the primary dead, promotes the replica and gives it a new, higher epoch number. If the old primary comes back later, other nodes see that its epoch is lower and refuse its writes. This is called fencing, and it prevents the nightmare of two databases both believing they are the primary (the split-brain problem).
Failover: detect, promote with a higher epoch, fence the old primary when it returns
Output
Mode: async replication (replica is 2 s behind)
t=12 db-1 stops answering
t=12 missed heartbeat 1
t=13 missed heartbeat 2
t=14 missed heartbeat 3, declare db-1 dead
t=15 promote db-2 (epoch 2), takes 4 s
t=19 db-2 accepts writes
downtime: 7 s
orders acknowledged but missing on db-2: 2 (ids 10-11)
t=30 db-1 returns on epoch 1, db-2 is on epoch 2: db-1 is fenced and demoted to replica
Mode: sync replication (replica is never behind)
t=12 db-1 stops answering
t=12 missed heartbeat 1
t=13 missed heartbeat 2
t=14 missed heartbeat 3, declare db-1 dead
t=15 promote db-2 (epoch 2), takes 4 s
t=19 db-2 accepts writes
downtime: 7 s
orders acknowledged but missing on db-2: 0
t=30 db-1 returns on epoch 1, db-2 is on epoch 2: db-1 is fenced and demoted to replica
Dry run. The primary stops answering at second 12. Heartbeats are missed at seconds 12, 13 and 14, so the monitor declares it dead at second 14. Promotion starts at 15, takes 4 seconds and the new primary accepts writes at second 19. That is 7 seconds of downtime for writes, and the design can never make it zero. Now the important part. One order is written per second, so orders 1 to 11 had been confirmed to customers before the crash. With asynchronous replication the replica is 2 seconds behind and only has orders up to 9, so orders 10 and 11 are missing: customers were told yes and the new primary does not know about them. With synchronous replication the replica is never behind, so nothing is lost, at the price of slower writes all the time. At second 30 the old primary returns on epoch 1, sees epoch 2 on db-2 and is demoted instead of accepting writes.
This is the same trade-off as in the CAP theorem lesson: during a failure you choose between staying fast and never losing an acknowledged write.
8. Active-Active or Active-Passive?
There are two ways to run copies. In an active-active setup every copy serves traffic at the same time, like our two app servers. In an active-passive setup one copy works and the other waits, like our database primary and replica. The choice is not a matter of taste; it follows from whether both copies can safely take traffic at once.
Choosing between active-active and active-passive
Active-active has one rule that is easy to forget: each copy must be able to carry the whole load alone. Suppose two app servers share 1,000 requests per second and each can handle 700. Normally each does 500 and everything looks fine. When one fails, 1,000 requests land on a server that can handle 700, so the survivor falls over too. Redundancy on paper, outage in practice. The fix is capacity planning, not another diagram.
Active-passive has a different catch: a standby that has never taken over is untested. Practise the failover on a schedule so the first real one is not also the first attempt.
9. Shared Fate: Redundancy That Is Not Redundant
Two components have shared fate when one event can take both down. The usual suspects are the same zone, the same rack, the same account, the same network path or the same bad configuration pushed to both. The program below checks each pair for what it shares.
A zone outage removes both copies if they share the zone
Output
As first built
lb lb-1, lb-2 shares: zone, rack, account -> one zone outage removes both
app app-1, app-2 shares: account -> one account problem removes both
db db-1, db-2 shares: zone, account -> one zone outage removes both
backup db-1 data, backup-1 shares: account -> one account problem removes both
After spreading them out
lb lb-1, lb-2 shares: account -> one account problem removes both
app app-1, app-2 shares: account -> one account problem removes both
db db-1, db-2 shares: account -> one account problem removes both
backup db-1 data, backup-1 shares: nothing -> independent
Dry run. In the first build both load balancers are in zone-a and rack-1, so a single zone outage (or a single rack power failure) removes both. The two database nodes share zone-a, and the backup lives in the same account as the primary. The app servers are in different zones, so only the account is shared. After spreading out, the load balancers and the database sit in different zones and racks, and the backup moves to a separate vault account, so a deleted or locked account cannot take the data and its backup together. Everything still shares the production account, which the team accepts for the app tier: it is the same trade-off as section 12.
10. Hidden SPOFs: People, Pipelines and Secrets
Many diagrams only show the runtime path, the parts that serve a request. There is also a recovery path, the parts you need to fix things at 2 AM: the deploy pipeline, the password vault, the runbook, the cloud account and the people who know how to use them. A system can serve traffic happily and still be one bad night away from a long outage, because nobody can roll back.
The runtime path is healthy, but recovery depends on one laptop and one person
| Layer | Hidden SPOF in the pharmacy app | Simple fix |
|---|---|---|
| Deployment | The production deploy key lives on one engineer's laptop | Store it in a shared vault; let three people deploy |
| Secrets | App servers cannot start if the vault is down | Cache secrets locally; test a restart with the vault off |
| Operations | Only one engineer knows how to fail over the database | Write the runbook, practise it with a second person |
| Account | One cloud account owns the primary and the backups | Keep backups in a separate account |
| Third party | One SMS vendor for every login code | A second vendor, or login by email as a fallback |
These are cheap to fix compared with a second database cluster, and they are often the ones that turn a short incident into a long one.
11. Graceful Degradation: When a Dependency Cannot Be Duplicated
Not every dependency should be able to take the product down. The product page of the app shows personal medicine suggestions from a recommendation service. If that service is slow, the page must not wait for it forever. Graceful degradation means answering with a simpler version (a cached trending list) instead of failing. A circuit breaker goes one step further: after a few timeouts in a row it stops calling the sick service for a while, so the page stops paying the timeout every time.
Time out, fall back to a cached list and open the breaker after repeated timeouts
Output
req recommendation naive guarded what happened
1 40 ms 70 70 answered in time
2 55 ms 85 85 answered in time
3 900 ms 930 235 timeout: show trending
4 1200 ms 1230 235 timeout: show trending, breaker opens
5 60 ms 90 35 breaker open: skip the call, show trending
6 45 ms 75 35 breaker open: skip the call, show trending
7 1500 ms 1530 35 breaker open: skip the call, show trending
8 1100 ms 1130 235 timeout: show trending
9 1300 ms 1330 235 timeout: show trending, breaker opens
10 50 ms 80 35 breaker open: skip the call, show trending
11 40 ms 70 35 breaker open: skip the call, show trending
12 55 ms 85 35 breaker open: skip the call, show trending
pages slower than 500 ms: naive 5, guarded 0
slowest page: naive 1530 ms, guarded 235 ms
Dry run. The page takes 30 ms by itself. Requests 1 and 2 get answers in 40 and 55 ms, so both versions are fine. Request 3 gets an answer after 900 ms. The naive page waits and takes 930 ms. The guarded page gives up after 200 ms, shows the trending list and finishes in 235 ms. Request 4 also times out, which is the second timeout in a row, so the breaker opens. For the next three requests the guarded page does not even call the service and finishes in 35 ms. The cost is visible too: requests 5, 6 and 10 to 12 had a healthy service, but the open breaker still skipped them. Over the 12 requests the naive version had 5 pages slower than 500 ms and a worst case of 1,530 ms; the guarded version had none and a worst case of 235 ms.
Degraded mode should be visible and honest. A page that says "showing popular items right now" is better than one that quietly shows stale personal suggestions.
12. Fix, Fall Back, Watch or Schedule?
You cannot remove every SPOF, and you should not try. Every extra copy adds cost, a new failure state to test and one more thing to configure wrongly. For each SPOF the team decides openly, and writes the decision down.
A simple way to decide what to do with each SPOF you find
| Decision | When it fits | Pharmacy app example |
|---|---|---|
| Fix it now | Critical flow, fix is affordable | Second load balancer, second DNS provider, database replica |
| Add a fallback | Critical flow, but a fallback keeps the core alive | Payment gateway down: offer cash on delivery |
| Watch it | Low impact or very rare failure | The internal analytics dashboard |
| Schedule it | Critical, fix not affordable yet | Second-region database, planned for next quarter |
The honest answer for a small team is often "not yet". A SPOF you know about, have measured and have a plan for is a very different thing from one nobody has looked at.
13. Prove It With Failure Drills
An architecture diagram shows what you intended. Only a drill shows what you built. After the fixes, the team runs these in a test environment first and then, carefully, in production at a quiet hour.
Stop
app-1. Expect: no failed orders, the other server absorbs the load (check its CPU).Cut the network to
db-1. Expect: a failover in seconds, a short write outage and a count of lost orders.Block the SMS provider. Expect: login codes switch to the second vendor.
Revoke the payment gateway key. Expect: the app offers cash on delivery.
Ask the person with the deploy key to be unreachable for a day. Expect: someone else can still deploy and roll back.
Restore last night's backup into an empty database. Expect: it works, and you know how long it took.
The pharmacy app after the fixes: two of every critical part, spread over two zones
The result is not a perfect system. The app tier and the database still share one production account, and the payment path still has one gateway with a fallback. But every single-copy stage is now either fixed, covered by a fallback or on a list with a reason.
Common Mistakes
Counting servers instead of tracing flows, and missing the DNS record or the vault behind them.
Putting both copies in the same zone, rack or account.
Adding a standby and never testing the failover.
Sizing active-active copies so that one cannot carry the whole load.
Using asynchronous replication without knowing how many acknowledged writes a failover can lose.
Treating a backup as a replica, or a replica as a backup. A replica copies a mistake just as faithfully as it copies good data.
Ignoring people and processes: one deploy key, one runbook, one expert.
Best Practices
List the user flows first and trace each one end to end, including DNS, secrets and third parties.
Rank SPOFs by blast radius, then by likelihood and recovery time.
Spread copies across zones and accounts so that failures stay independent.
Give every failover a heartbeat, a clear promotion rule and fencing.
Use timeouts and circuit breakers on every optional dependency.
Write the decision (fix, fall back, watch or schedule) next to every SPOF.
Practise the failures on a calendar, and write down what you learn.
Practice Problems
Add a fifth flow, refill reminders, that needs only DNS, the load balancer, an app server and a scheduler. Which new SPOF appears if there is one scheduler?
Change the traffic shares to login 10%, order 60%, prescription 10%, track 20%. Which component now has the biggest blast radius after
dns-aandlb-1?Change the replica lag to 5 seconds in the failover program. How many acknowledged orders does a failover now lose?
Interview Questions
What is a single point of failure? A component with no working alternative whose failure stops a user flow or the whole system.
How do you find SPOFs? Trace each critical user flow end to end, list every dependency (including DNS, secrets, third parties and people) and ask what happens if each one disappears alone.
What is blast radius? The share of users, traffic or money affected when one component fails. It decides which SPOF to fix first.
Why are two servers not always redundant? If they share a zone, rack, account or network path they fail together, and if one cannot carry the whole load the survivor fails too.
Active-active or active-passive? Active-active when every copy can serve traffic at once (stateless app servers); active-passive when only one may write (a database primary).
How do you prevent split-brain after a failover? Give each promotion a higher epoch number and refuse writes from a node with an older epoch (fencing).
Is replication a backup? No. A replica copies deletes and corruption too; you need point-in-time backups kept apart from the primary.
When is it fine to keep a SPOF? When the flow is low impact or the failure is very rare, and the decision is explicit, watched and revisited.
Summary
| Idea | What to remember |
|---|---|
| SPOF | One component whose failure stops a flow or the system |
| Finding them | Trace flows, remove one component at a time, include the recovery path |
| Blast radius | Rank by the share of traffic lost: database 90%, SMS 25%, one app server 0% |
| Redundancy math | Series multiplies availabilities down, parallel multiplies failure chances down |
| Failover | Heartbeat, promotion, fencing; async replication can lose acknowledged writes |
| Shared fate | Copies in one zone, rack or account fail together |
| Degradation | Timeouts, fallbacks and circuit breakers keep optional parts from taking the page down |
| Decisions | Fix, fall back, watch or schedule, and write down which |
A single point of failure is any part of a flow that has no working alternative.
Measure each SPOF by blast radius before deciding what to fix first.
Redundancy only counts when the copies fail independently and each can carry the load alone.
Failover needs detection, promotion and fencing, and you must know what a failover can lose.
Some SPOFs are people or processes, and some are worth accepting on purpose.
Previous topic: Consistent Hashing. Next: OSI Model.
Further reading
AlgoMaster: Single Point of Failure (SPOF) (a general overview with a different example).