SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
  • Scalability
  • Availability
  • Reliability
  • Single Point of Failure (SPOF)
  • Latency vs Throughput vs Bandwidth
  • Consistent Hashing
  • CAP Theorem
  • Fault Tolerance and Redundancy
  • Failover
  • Stateless vs Stateful
  • Concurrency vs Parallelism
  • Capacity Planning
  • Back Pressure
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Foundations/Core Concepts

Availability

How much of the time your system is up and working. Measured in nines.

⏱ 12 min readBeginnerMust KnowInterview FavouriteHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

Availability is the share of time a system is up and ready to work when users need it.

  • We measure it as a percentage, like 99.9%. People call this “three nines”.
  • Higher availability means less downtime. But each extra “nine” costs much more.
  • We get it with copies (redundancy), health checks and automatic switching (failover).
  • Remember: up is not the same as correct. That is reliability, the next topic.

02Concept: What is it?

Availability = the time the system is working ÷ the total time. If a website was down for 1 hour in a 100-hour period, its availability was 99%.

🧠Formula
Availability = Uptime ÷ (Uptime + Downtime) × 100

The “nines” table

AvailabilityNicknameDown per yearDown per month (30 days)
90%one nine36.5 days3 days
99%two nines3.65 days7.2 hours
99.9%three nines8.76 hours43.2 minutes
99.99%four nines52.6 minutes4.32 minutes
99.999%five nines5.26 minutes25.9 seconds
Each extra nine cuts downtime by 10 times
90%36.5 days
99%3.65 days
99.9%8.76 hours
99.99%52.6 minutes
99.999%5.26 minutes
Bars show downtime per year, compared with 90%.
📝Bars are not to scale
The last bars would be too thin to see if we drew them exactly. The numbers on the right are the real values.

03Real-Life Example

🍵The 24-hour chemist shop
A chemist shop says “open 24 hours”. But sometimes the owner is sick and the shop is closed at night. If you come at that time, you are unlucky. A better shop has two staff members. If one is sick, the other opens the shop. The shop is “available” much more often.
One staff vs two staff
One person
🧑‍⚕️Owner
↓
😷Sick todayshop closed
Two people
🧑‍⚕️Ownersick
🧑‍⚕️Helperworks
↓
🏪Shop open
Chemist shop
Software system
Shop open
System up
Owner is sick
Server fails
Helper takes over
Failover to a backup server
Two staff members
Redundancy
Check if someone is at the door
Health check

04Why Do We Need It?

When a system is down, users cannot use it. For some products, even a few minutes hurts.

💸Money
A shop that is down cannot sell. Payments that fail lose trust.
🤝Trust
Users leave products that are often down.
🏥Safety
Hospital and emergency systems must always be up.
📜Promises
Many companies promise uptime to customers in an agreement (SLA).
Users do not care why you are down. They only see that you are down.

05Where Do We Use It?

Every system needs some availability. How many nines you need depends on what a failure costs.

💳Payments
Very high. Failed payments hurt people.
🏥Healthcare
Very high. Lives may depend on it.
🛒E-commerce
High. Every minute down loses sales.
💬Messaging
High. People expect it to always work.
📰Blog or news site
Medium. A short outage is fine.
🧪Internal test tool
Low. It can be down at night.

06Types / Parts / How It Works

1. Redundancy: keep spare parts

Run more than one of everything important. If one fails, another is ready.

Two common backup styles
Active-passive
🖥️Activeserves users
↕heartbeat
🖥️Passivewaits as backup
Active-active
⚖️Load balancer
🖥️Server Aserves users
🖥️Server Bserves users
Active-passive
  • One server works, one waits
  • Simple to reason about
  • The waiting server is wasted until a failure
  • Switching takes a few seconds
Active-active
  • Every server works
  • Uses all the hardware
  • Loses only part of capacity if one fails
  • Harder to keep data in sync

2. Failover: switch automatically

A health check asks “are you OK?” every few seconds. When a server stops answering, traffic moves to a healthy one. Nobody has to wake up.

3. Spread over places

Do not keep everything in one place
👥Users
→↓
🌍Global routing
→↓
Data centre A
🖥️Servers
Data centre B
🖥️Servers
Zone / region A Zone / region B
A fire, flood or power cut can take down a whole data centre.

4. Two parts in a chain, or with a backup

SetupHow to calculateExample with two parts at 99%
In a chain (need both)A × B0.99 × 0.99 = 98.01% (worse)
With a backup (need one)1 − (1 − A) × (1 − B)1 − 0.01 × 0.01 = 99.99% (better)
📝Note
This assumes the parts fail on their own. If two servers share the same power line, they can fail together, and the real number is lower.
VisualizerHow many nines? How much downtime?Drag the slider, then switch between one server, a chain and a backup.
How are they connected?
👥Users
→↓
🖥️Server99.9%
System availability
99.9%
Down per year
8.8 hours
Down per month
43.8 min
Down per day
1.4 min
Downtime compared with 90% availability1.0000% of the 90% case
One server is simple. Each extra 9 cuts the allowed downtime by 10 times, but each extra 9 costs more.

07How to Use It / Steps / Implementation

  1. 1
    Decide the target
    How many nines does the product really need? Say it as a number.
  2. 2
    Find single points of failure
    Which one part would stop everything?
  3. 3
    Add redundancy
    Run two or more of each important part.
  4. 4
    Add health checks
    Detect bad servers in seconds.
  5. 5
    Automate failover
    Move traffic away from bad parts without a human.
  6. 6
    Spread across zones or regions
    Survive a whole data centre failure.
  7. 7
    Release carefully
    Roll out changes slowly (canary, blue-green) so a bad release does not take everything down.
  8. 8
    Monitor and practise
    Set alerts. Test failures on purpose before real ones happen.
💡Do not forget planned downtime
Maintenance and upgrades count as downtime too, unless you can do them with no interruption.

08Key Terms to Know

TermMeaning in easy words
UptimeThe time the system is working
DowntimeThe time the system is not working
The ninesA way to say availability, like 99.9% = three nines
SLAService Level Agreement: a promise to customers, often with a refund if broken
SLOService Level Objective: the internal target, like 99.95%
SLIService Level Indicator: the real measured number
RedundancyKeeping extra copies of parts, so one failure is not the end
FailoverSwitching to a backup when the main part fails
Health checkA regular test to see if a server is working
MTBFMean time between failures: how long a part works before it fails
MTTRMean time to repair: how fast you fix it. Lower is better

09Pros, Cons and Trade-offs

✅ Pros
  • Users can rely on the product
  • Fewer lost sales and angry customers
  • Failures are handled without a human
  • Easier to meet an SLA
⚠️ Cons
  • More servers and more cost
  • More complex design
  • Data copies must stay in sync
  • Each extra nine is much more expensive than the last

Trade-offs

ChoiceWe gainWe lose
Active-passiveSimple failoverIdle hardware cost
Active-activeBetter use of hardwareHarder data sync
Multi-regionSurvives a regional outageHigher cost, more delay between regions
Automatic failoverFast recoveryA false alarm can cause a needless switch
Availability over consistency (CAP)System keeps answeringData may be slightly old
⚠️Pick the right number
Aiming for five nines on a small blog wastes money. Match the target to the cost of being down.

10Common Problems and Mistakes

Common mistakes

  1. Single points of failure. One database or one load balancer can still stop everything.
  2. Backups that were never tested. A failover that has never run may not work when needed.
  3. Forgetting dependencies. If your system needs five services at 99.9%, together it is lower than 99.9%.
  4. Bad releases. Many outages come from our own changes, not hardware.
  5. Ignoring planned downtime. It still counts for users.
  6. Mixing up “up” and “correct”. A system can be up and still give wrong answers.

Problems that appear at scale

🧠Split brain
Two servers both think they are the main one and both accept writes.
🚨False alarms
A health check fails by mistake and traffic is moved for no reason.
⛓️Cascading failure
One failure overloads the rest, and they fail too.

11Real-World Examples

These are general ideas about how well-known products stay available. Details inside each company are more complex.

☁️Cloud providers
Offer many “zones” in a region. You can run copies in more than one zone to survive a data centre failure.
🎬Streaming sites
Keep content in many places, so one failure does not stop the video.
💳Banks and UPI
Use backup systems and sites, so payments keep working.
🛒Shopping sites
Prepare extra capacity and backups before big sale days.
Failover in action
👥Users
→↓
⚖️Load balancerhealth checks
⇢⇣stopped
💥Main serverfailed
↓traffic moves
🖥️Backup servernow serving
The health check sees the main server stop answering, and traffic moves to the backup.

12Related Topics to Read Next

Reliability→

Up is not enough. The answers must also be correct.

Single Point of Failure (SPOF)→

The first thing to remove to raise availability.

Scalability→

A system must stay up while it grows.

CAP Theorem→

When the network breaks, you must choose availability or consistency.

What are Load Balancers?→

They run the health checks and move traffic away from bad servers.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • ✔What: the share of time the system is up and working.
  • ✔Formula: uptime ÷ (uptime + downtime).
  • ✔Numbers: 99.9% ≈ 8.76 h/year · 99.99% ≈ 52.6 min/year · 99.999% ≈ 5.26 min/year.
  • ✔Chain: multiply (gets worse). Backup: 1 − (1 − A)(1 − B) (gets better).
  • ✔Tools: redundancy, health checks, failover, multi-zone, safe releases.
  • ✔Backup styles: active-passive and active-active.
  • ✔Cost: each extra nine costs far more. Choose a target that fits the need.
  • ✔One line: “Availability means the system is there when you need it.”
← Previous
Scalability
Next →
Reliability