Nextgen Blog
HomeLearnAIQuantumRoboticsSecuritySpaceAbout
Nextgen Blog

By Anubhav — full stack engineer, IIT Mandi CSE. Deep dives into AI, software engineering, and the technologies shaping the next generation of tech.

Navigate

  • Home
  • Learn
  • Blog
  • Archive
  • About

Topics

  • Artificial Intelligence
  • Quantum Computing
  • Robotics
  • Cybersecurity
  • Space Tech

Connect

Built with ❤️ & By - Anubhav

© 2026 Nextgen Blog by Anubhav. All rights reserved.

Privacy PolicyTerms of Service
Phase 06 · Resilience, Security & OperationsChapter 29 of 33
28.
Phase 06Read time ~25 minDifficulty advanced

High Availability

In this chapter
  • 01Chapter Overview
  • 02Availability vs Reliability
  • 03Availability
  • 04Reliability
  • 05Availability Formula
  • 06MTBF
  • 07MTTR
  • 08Why MTTR Is Important
  • 09System A
  • 10System B
  • 11The Availability "Nines"
  • 12Why Five Nines Is Difficult
  • 13SLA, SLO, SLI
  • 14SLI
  • 15SLO
  • 16SLA
  • 17Example
  • 18Redundancy
  • 19Single Point of Failure
  • 20Redundancy Types
  • 21Failure Domains
  • 22Availability Zone
  • 23Multi-AZ Architecture
  • 24Active-Passive Architecture
  • 25Active-Active Architecture
  • 26Active-Active vs Active-Passive
  • 27Stateless Application Servers
  • 28Load Balancer and HA
  • 29Health Checks
  • 30Liveness vs Readiness
  • 31Liveness
  • 32Readiness
  • 33Graceful Degradation
  • 34Feature Prioritization
  • 35Critical
  • 36Important
  • 37Optional
  • 38Dependency Failure
  • 39Cascading Failure
  • 40Circuit Breaker
  • 41Bulkheads
  • 42Load Shedding
  • 43Backpressure
  • 44Retry Storms
  • 45Exponential Backoff + Jitter
  • 46Database High Availability
  • 47Synchronous vs Asynchronous Replication
  • 48Synchronous
  • 49Asynchronous
  • 50Database Failover
  • 51RPO
  • 52RTO
  • 53Disaster Recovery
  • 54Multi-Region Architecture
  • 55Active-Passive Multi-Region
  • 56Active-Active Multi-Region
  • 57Failure Detection and Failover
  • 58Automatic vs Manual Failover
  • 59Automatic
  • 60Manual
  • 61Deployment and Availability
  • 62Rolling deployment
  • 63Blue-Green Deployment
  • 64Canary Deployment
  • 65Availability and Caching
  • 66Availability and Queues
  • 67Availability and Capacity
  • 68N+1 Redundancy
  • 69N+2 Redundancy
  • 70Availability Math for Independent Components
  • 71Parallel Redundancy
  • 72Correlated Failures
  • 73Blast Radius
  • 74Error Budgets
  • 75Error Budget Example
  • 76Graceful Degradation Example
  • 77HA Architecture Example
  • 78HA Design Process
  • 79Step 1
  • 80Step 2
  • 81Step 3
  • 82Step 4
  • 83Step 5
  • 84Step 6
  • 85Step 7
  • 86Step 8
  • 87Step 9
  • 88Step 10
  • 89Failure-Oriented Design
  • 90Chaos Engineering
  • 91Common Misconception #1
  • 92Wrong
  • 93Common Misconception #2
  • 94Wrong
  • 95Common Misconception #3
  • 96Wrong
  • 97Common Misconception #4
  • 98Wrong
  • 99Common Misconception #5
  • 100Wrong
  • 101Interview Question: What Is High Availability?
  • 102Answer
  • 103Interview Question: Active-Active vs Active-Passive
  • 104Answer
  • 105Interview Question: What Is RTO?
  • 106Answer
  • 107Interview Question: What Is RPO?
  • 108Answer
  • 109Interview Question: How Do You Remove a SPOF?
  • 110Interview Question: How Do You Prevent Cascading Failures?
  • 111Mini Project
  • 112Design a Highly Available E-Commerce Platform
  • 113Advanced HA Exercise
  • 114Production HA Checklist
  • 115Final Mental Model
  • 116Summary
  • 117Exercises
  • 118Exercise 1
  • 119Exercise 2
  • 120Exercise 3
  • 121Exercise 4
  • 122Exercise 5
  • 123Exercise 6
  • 124Exercise 7
  • 125Next Chapter
  • 126Chapter 28 — Fault Tolerance
In this chapter (126 sections)
01Chapter Overview02Availability vs Reliability03Availability04Reliability05Availability Formula06MTBF07MTTR08Why MTTR Is Important09System A10System B11The Availability "Nines"12Why Five Nines Is Difficult13SLA, SLO, SLI14SLI15SLO16SLA17Example18Redundancy19Single Point of Failure20Redundancy Types21Failure Domains22Availability Zone23Multi-AZ Architecture24Active-Passive Architecture25Active-Active Architecture26Active-Active vs Active-Passive27Stateless Application Servers28Load Balancer and HA29Health Checks30Liveness vs Readiness31Liveness32Readiness33Graceful Degradation34Feature Prioritization35Critical36Important37Optional38Dependency Failure39Cascading Failure40Circuit Breaker41Bulkheads42Load Shedding43Backpressure44Retry Storms45Exponential Backoff + Jitter46Database High Availability47Synchronous vs Asynchronous Replication48Synchronous49Asynchronous50Database Failover51RPO52RTO53Disaster Recovery54Multi-Region Architecture55Active-Passive Multi-Region56Active-Active Multi-Region57Failure Detection and Failover58Automatic vs Manual Failover59Automatic60Manual61Deployment and Availability62Rolling deployment63Blue-Green Deployment64Canary Deployment65Availability and Caching66Availability and Queues67Availability and Capacity68N+1 Redundancy69N+2 Redundancy70Availability Math for Independent Components71Parallel Redundancy72Correlated Failures73Blast Radius74Error Budgets75Error Budget Example76Graceful Degradation Example77HA Architecture Example78HA Design Process79Step 180Step 281Step 382Step 483Step 584Step 685Step 786Step 887Step 988Step 1089Failure-Oriented Design90Chaos Engineering91Common Misconception #192Wrong93Common Misconception #294Wrong95Common Misconception #396Wrong97Common Misconception #498Wrong99Common Misconception #5100Wrong101Interview Question: What Is High Availability?102Answer103Interview Question: Active-Active vs Active-Passive104Answer105Interview Question: What Is RTO?106Answer107Interview Question: What Is RPO?108Answer109Interview Question: How Do You Remove a SPOF?110Interview Question: How Do You Prevent Cascading Failures?111Mini Project112Design a Highly Available E-Commerce Platform113Advanced HA Exercise114Production HA Checklist115Final Mental Model116Summary117Exercises118Exercise 1119Exercise 2120Exercise 3121Exercise 4122Exercise 5123Exercise 6124Exercise 7125Next Chapter126Chapter 28 — Fault Tolerance

1. Chapter Overview#

A distributed system is not useful if it works only when everything is healthy.

Production systems must continue serving users when:

  • a server crashes
  • a database fails
  • a network link breaks
  • a deployment goes wrong
  • a zone becomes unavailable
  • a dependency becomes slow
  • traffic suddenly increases
  • an entire region experiences an outage

This is the goal of High Availability (HA).

A simple definition is:

High availability means designing a system so that it continues providing its intended service despite failures.

HA is not the same as:

"Nothing ever fails."

Instead:

Failures happen
     ↓
Detect failure
     ↓
Fail over / degrade
     ↓
Continue serving

2. Availability vs Reliability#

These terms are related but different.

Availability#

Availability asks:

Is the service usable right now?

Example:

Request → Response

Reliability#

Reliability asks:

Does the system continue working correctly over time without failure?

A system can be:

Highly available
but occasionally incorrect

or:

Reliable
but unavailable during planned maintenance

A good production system aims for both.


3. Availability Formula#

A simple availability calculation is:

Availability =
Uptime / (Uptime + Downtime)

For example:

Uptime = 99 hours
Downtime = 1 hour
 
Availability =
99 / 100
= 99%

Another common representation is:

Availability =
MTBF / (MTBF + MTTR)

Where:

  • MTBF = Mean Time Between Failures
  • MTTR = Mean Time To Recovery

4. MTBF#

Mean Time Between Failures measures the average time between failures.

Higher MTBF generally means:

Failures happen less frequently

Example:

System operates for 1,000 hours
between failures on average.

MTBF:

1000 hours

5. MTTR#

Mean Time To Recovery measures how quickly the system is restored after failure.

Example:

Failure detected
    ↓
Engineer/system responds
    ↓
Service restored

If recovery takes:

5 minutes

then reducing MTTR from:

30 min → 5 min

can significantly improve availability.


6. Why MTTR Is Important#

Suppose two systems have similar failure frequency.

System A#

Failure every 30 days
Recovery = 1 hour

System B#

Failure every 30 days
Recovery = 5 minutes

System B has much less downtime.

Therefore HA is not only about preventing failures.

It is also about:

Detecting and recovering from failures quickly.


7. The Availability "Nines"#

Availability is often described using "nines".

Examples:

99%
99.9%
99.99%
99.999%

Higher availability means less allowed downtime.

Approximate annual downtime:

Availability Approx. downtime/year
99% 3.65 days
99.9% 8.76 hours
99.99% 52.56 minutes
99.999% 5.26 minutes
99.9999% 31.5 seconds

These are approximate theoretical values for a 365-day year.


8. Why Five Nines Is Difficult#

Suppose your target is:

99.999%

That allows only about:

5.26 minutes/year

That budget must potentially include:

  • server failures
  • database failures
  • network failures
  • deployments
  • configuration mistakes
  • dependency outages
  • operational incidents

Therefore extremely high availability requires significant engineering and operational discipline.


9. SLA, SLO, SLI#

These three terms are frequently used together.

SLI#

Service Level Indicator

A measurement.

Examples:

Availability
Latency
Error rate

Example:

99.97% successful requests

SLO#

Service Level Objective

The target.

Example:

99.95% availability

SLA#

Service Level Agreement

A formal commitment, often contractual, between a provider and customer.


10. Example#

Suppose:

SLI:
successful request percentage
 
SLO:
99.9%
 
SLA:
99.5%

Interpretation:

Measurement → SLI
Internal target → SLO
External commitment → SLA

Do not use these terms interchangeably.


11. Redundancy#

The most fundamental HA technique is:

Don't depend on a single component.

Bad:

User
  ↓
Server A
  ↓
Database A

If Server A fails:

Service unavailable

Better:

             Load Balancer
              /        \
             /          \
        Server A      Server B
             \          /
              \        /
               Database

Now one application server can fail without necessarily taking down the service.


12. Single Point of Failure#

A Single Point of Failure (SPOF) is a component whose failure can take down the service.

Example:

              Load Balancer
                    │
                    ▼
               Server A
                    │
                    ▼
               Database A

Potential SPOFs:

Load Balancer
Server A
Database A
Network path
Storage

HA design tries to remove or mitigate critical SPOFs.


13. Redundancy Types#

Common redundancy approaches include:

  • multiple servers
  • multiple databases
  • replicated storage
  • multiple availability zones
  • multiple regions
  • redundant network paths
  • multiple load balancers

The right redundancy level depends on the failure domain you need to survive.


14. Failure Domains#

A failure domain is a group of resources that can fail together.

Examples:

Server
Rack
Availability Zone
Region
Cloud provider

If all replicas are inside one rack:

Rack failure
     ↓
All replicas fail

Therefore:

Replication is only useful if replicas are sufficiently independent.


15. Availability Zone#

Cloud providers divide regions into isolated infrastructure locations commonly called:

Availability Zones

Conceptually:

Region
├── AZ A
├── AZ B
└── AZ C

If your application runs only in:

AZ A

an AZ-level outage can take it offline.

A multi-AZ design spreads critical components across zones.


16. Multi-AZ Architecture#

Example:

                  Load Balancer
                 /      |      \
                /       |       \
              AZ-A     AZ-B     AZ-C
               │         │        │
             App A     App B    App C
               │         │        │
               └──── Database ────┘

If one zone fails:

AZ-A ✗

traffic can potentially move to:

AZ-B
AZ-C

17. Active-Passive Architecture#

In active-passive:

Active
  │
  │ serves traffic
  │
Passive
  │
  │ standby

If active fails:

Active ✗
   ↓
Failover
   ↓
Passive becomes active

Advantages:

  • simpler state management
  • easier operational model
  • useful for certain databases

Disadvantages:

  • standby capacity may be underutilized
  • failover can take time
  • synchronization is required

18. Active-Active Architecture#

Both instances serve traffic:

        Load Balancer
          /       \
         /         \
    Active A     Active B
       │             │
       └──────┬──────┘
              │
           Data Layer

If A fails:

B continues serving

Advantages:

  • better resource utilization
  • faster failover
  • higher capacity

Challenges:

  • shared state
  • data consistency
  • conflict resolution
  • routing
  • distributed coordination

19. Active-Active vs Active-Passive#

Property Active-Active Active-Passive
Both serve traffic Yes No
Resource utilization Higher Lower
Failover Usually faster Usually slower
State complexity Higher Often lower
Operational complexity Higher Lower
Scalability Good More limited
Typical use Stateless apps, global services Some databases and failover systems

20. Stateless Application Servers#

Stateless services are easier to scale and fail over.

Bad architecture:

Session stored only in Server A memory

If:

Server A fails

the user's session disappears.

Better:

Application Servers
   │
   ▼
Shared session store

For example:

Server A ─┐
Server B ─┼──► Redis / Database
Server C ─┘

Now any server can handle the request.


21. Load Balancer and HA#

A load balancer distributes requests:

              Load Balancer
             /      |      \
            ▼       ▼       ▼
          App A   App B   App C

If App B fails:

App A ✓
App B ✗
App C ✓

health checks allow the load balancer to stop routing traffic to B.

The load balancer itself must also be highly available.


22. Health Checks#

A health check may verify:

HTTP response
Process state
Database connectivity
Dependency health

Example:

GET /health

Response:

200 OK

But a simple HTTP 200 may not prove the application is actually capable of serving production traffic.

This is why systems often distinguish:

  • liveness
  • readiness
  • startup health

23. Liveness vs Readiness#

Liveness#

Answers:

Is the process alive?

Readiness#

Answers:

Can this instance safely receive traffic?

Example:

Process alive ✓
Database connection ✗

Liveness:

healthy

Readiness:

not ready

The load balancer should generally avoid routing production traffic to an instance that is not ready.


24. Graceful Degradation#

HA does not always mean:

Everything works perfectly.

Sometimes the best strategy is:

Core functionality continues
non-critical features degrade

Example:

Shopping site
 
Checkout       ✓
Payment        ✓
Product page   ✓
Recommendations ✗
Reviews        ✗
Analytics      ✗

Users can still complete the critical operation.


25. Feature Prioritization#

During failures, categorize features:

Critical#

Login
Checkout
Payment
Order retrieval

Important#

Search
Recommendations
Reviews

Optional#

Personalized analytics
Advanced suggestions

This allows the system to shed non-critical work when dependencies fail.


26. Dependency Failure#

Suppose:

Checkout Service
       │
       ▼
Recommendation Service
       │
       X

If checkout synchronously depends on recommendations:

Recommendation failure
        ↓
Checkout failure

This is bad dependency design.

Instead:

Checkout
   │
   ├── Payment
   └── Inventory
 
Recommendations
   │
   └── Optional

Non-critical dependencies should not unnecessarily sit on critical request paths.


27. Cascading Failure#

A cascading failure occurs when one failure causes additional failures.

Example:

Service A slows
     ↓
Service B waits
     ↓
Threads accumulate
     ↓
Service B slows
     ↓
Service C retries
     ↓
Traffic increases
     ↓
More overload

Eventually:

Entire system degrades

HA design must prevent cascades.


28. Circuit Breaker#

A circuit breaker protects services from repeatedly calling a failing dependency.

States:

CLOSED
   ↓
Failures increase
   ↓
OPEN
   ↓
Wait
   ↓
HALF-OPEN
   ↓
Test request

If dependency recovers:

HALF-OPEN → CLOSED

If failure continues:

HALF-OPEN → OPEN

29. Bulkheads#

A bulkhead isolates resources.

Suppose one dependency consumes all worker threads:

Dependency A
     ↓
All threads consumed
     ↓
Dependency B also fails

Instead allocate separate pools:

Pool A → Dependency A
Pool B → Dependency B

If A fails:

Pool A exhausted
Pool B still works

This is inspired by compartmentalization in ships.


30. Load Shedding#

When a system is overloaded, accepting every request can make the system collapse.

Instead:

Traffic
  ↓
Capacity exceeded
  ↓
Reject/defer lower-priority work
  ↓
Protect critical operations

Examples:

HTTP 429
Queue limits
Request prioritization
Admission control

31. Backpressure#

Backpressure means:

A downstream system communicates that it cannot safely accept work at the current rate.

Example:

Producer
  ↓
Queue
  ↓
Consumer

If consumer capacity is:

1,000 msg/sec

but producer sends:

10,000 msg/sec

the system needs:

  • queueing
  • throttling
  • load shedding
  • scaling
  • backpressure

Otherwise queues can grow without bound.


32. Retry Storms#

Suppose a dependency fails.

100 servers each retry:

1 request
↓
retry
↓
retry
↓
retry

Instead of reducing traffic, retries can multiply it.

Example:

Normal:
10,000 req/sec
 
Failure:
10,000 original
+
20,000 retries
+
40,000 retries
...

This can create a retry storm.


33. Exponential Backoff + Jitter#

Use:

1s
2s
4s
8s
16s

plus random jitter:

1.2s
2.7s
4.1s

This prevents all clients from retrying at exactly the same moment.


34. Database High Availability#

A database is often the most important HA component.

Basic architecture:

             Application
                  │
                  ▼
                Leader
               /      \
              ▼        ▼
          Replica A  Replica B

If leader fails:

Leader ✗
   ↓
Election / failover
   ↓
Replica becomes leader

The exact mechanism depends on the database.


35. Synchronous vs Asynchronous Replication#

Synchronous#

The primary waits for required replicas before confirming the write.

Write
 ↓
Primary
 ↓
Replica
 ↓
ACK

Benefits:

  • stronger durability/consistency guarantees

Costs:

  • higher latency
  • availability sensitivity

Asynchronous#

Primary acknowledges before all replicas have applied the write.

Write
 ↓
Primary → ACK
 
Later:
Primary → Replica

Benefits:

  • lower write latency
  • better availability

Cost:

  • replication lag
  • possible recent-write loss depending on failure and durability design

36. Database Failover#

Suppose:

Primary A
Replica B
Replica C

A fails.

Failover process:

Detect failure
      ↓
Select candidate
      ↓
Promote candidate
      ↓
Redirect traffic
      ↓
Reconfigure replication

Potential risks:

  • stale replica
  • split brain
  • lost writes
  • long detection time
  • application connection failures

37. RPO#

Recovery Point Objective (RPO) asks:

How much data loss can the business tolerate?

Examples:

RPO = 0

means:

No data loss acceptable

Another system might tolerate:

RPO = 5 minutes

meaning losing up to approximately five minutes of recent changes may be acceptable under a disaster scenario.


38. RTO#

Recovery Time Objective (RTO) asks:

How quickly must the service be restored?

Example:

RTO = 5 minutes

means the recovery process should restore the service within the defined target.

RPO and RTO are different:

RPO → data loss tolerance
RTO → downtime tolerance

39. Disaster Recovery#

HA and disaster recovery overlap but are not identical.

HA focuses on:

Continuing service through failures

DR focuses more broadly on:

Recovering from major disasters

Examples:

  • region outage
  • data corruption
  • accidental deletion
  • ransomware
  • infrastructure destruction
  • major configuration failure

40. Multi-Region Architecture#

Example:

             Global DNS / Router
                 /        \
                /          \
           Region A      Region B
              │              │
          App + DB        App + DB

If Region A becomes unavailable:

Traffic → Region B

But multi-region introduces difficult problems:

  • replication
  • consistency
  • conflict resolution
  • routing
  • failover
  • data residency
  • operational complexity

41. Active-Passive Multi-Region#

Region A
 ACTIVE
 
Region B
 PASSIVE

Traffic normally goes to A.

If A fails:

Failover
   ↓
Region B

Simpler than active-active but may have:

  • slower failover
  • unused capacity
  • replication lag

42. Active-Active Multi-Region#

             Global Router
              /          \
             ▼            ▼
        Region A       Region B
          Active         Active

Both regions serve users.

Benefits:

  • lower geographic latency
  • higher capacity
  • faster regional failover

Challenges:

  • concurrent writes
  • data conflicts
  • cross-region consistency
  • complex routing
  • operational complexity

43. Failure Detection and Failover#

Failover depends on detecting failure.

Typical flow:

Health monitoring
      ↓
Failure suspected
      ↓
Confirm according to policy
      ↓
Remove unhealthy target
      ↓
Promote replacement
      ↓
Redirect traffic
      ↓
Verify recovery

Too aggressive:

false failovers

Too conservative:

long downtime

44. Automatic vs Manual Failover#

Automatic#

System detects and performs failover.

Advantages:

  • fast
  • less human intervention

Risks:

  • false positives
  • automation mistakes
  • split brain
  • cascading failures

Manual#

Human decides.

Advantages:

  • more deliberate

Risks:

  • slower
  • human availability
  • operational pressure

Critical systems often combine automation with safeguards and controlled human intervention.


45. Deployment and Availability#

Deployments themselves can cause outages.

Bad strategy:

Stop all servers
    ↓
Deploy
    ↓
Start servers

Better:

Rolling deployment#

A B C D
 
Update A
Update B
Update C
Update D

Maintain capacity during the rollout.


46. Blue-Green Deployment#

Two environments:

Blue → current
Green → new

Deploy to Green.

Test:

Green ✓

Then switch traffic:

Blue ✗
Green ✓

If necessary:

Green ✗
Blue ✓

This can make rollback fast.


47. Canary Deployment#

Send a small percentage of traffic to the new version:

Old → 95%
New → 5%

Monitor:

  • errors
  • latency
  • business metrics

If healthy:

20%
50%
100%

If unhealthy:

New → 0%

This reduces deployment blast radius.


48. Availability and Caching#

Caching can improve availability by reducing dependency load.

Example:

Application
   │
   ▼
Cache
   │
   X
Database unavailable

If cached data is still valid:

Serve cached response

This is a form of graceful degradation.

But cached data may be stale, so the business must define acceptable staleness.


49. Availability and Queues#

Queues can absorb temporary spikes.

Clients
   │
   ▼
Queue
   │
   ▼
Workers

If workers temporarily slow down:

Queue buffers work

This can prevent immediate overload.

However:

A queue is not infinite capacity.

Eventually queue depth can become a failure signal.


50. Availability and Capacity#

Suppose:

Normal traffic = 5,000 req/sec
Peak traffic = 8,000 req/sec

If infrastructure supports only:

5,500 req/sec

the system is not truly highly available under peak conditions.

HA therefore requires enough capacity to survive:

  • traffic spikes
  • component failures
  • failover capacity shifts

51. N+1 Redundancy#

Suppose normal capacity requires:

3 servers

An N+1 design has:

4 servers

If one fails:

3 remain

and normal capacity can still be maintained.


52. N+2 Redundancy#

If you need to survive two simultaneous failures:

Normal = 3
Extra = 2
 
Total = 5

This increases resilience but also costs more.

The right redundancy level depends on:

  • failure assumptions
  • cost
  • business impact
  • capacity requirements

53. Availability Math for Independent Components#

Suppose two components are arranged in series:

A → B

The system is available only if both are available.

If:

Availability A = 99.9%
Availability B = 99.9%

Then approximately:

System availability
= 0.999 × 0.999
= 0.998001
≈ 99.8001%

Dependencies multiply the availability risk.


54. Parallel Redundancy#

Suppose two independent servers serve the same function:

      ┌── Server A ──┐
Request               → Response
      └── Server B ──┘

The system fails only if both fail.

If each has failure probability:

q = 1 - availability

then under a simplified independence assumption:

P(both fail) = q²

So redundancy can dramatically improve availability.

Real-world failures are often correlated, so this calculation is an approximation.


55. Correlated Failures#

Two replicas are not truly independent if they share:

Same rack
Same power source
Same zone
Same network path
Same software bug
Same deployment

Example:

Server A ─┐
Server B ─┼── same AZ
Server C ─┘

An AZ outage can remove all three.

Therefore physical and logical separation matters.


56. Blast Radius#

Blast radius means:

How much of the system is affected by a failure?

Example:

One service instance fails
→ small blast radius
 
Entire availability zone fails
→ larger blast radius
 
Entire region fails
→ very large blast radius

Good HA architecture limits blast radius.


57. Error Budgets#

An SLO creates an availability budget.

Suppose:

SLO = 99.9%

Allowed unavailability is approximately:

0.1%

This becomes an error budget.

The team can use it for:

  • deployments
  • experiments
  • controlled failures
  • maintenance

If the error budget is exhausted:

Slow risky changes
Focus on reliability

58. Error Budget Example#

Suppose monthly SLO:

99.9%

Monthly allowed downtime is approximately:

43.2 minutes

If an incident consumes:

30 minutes

remaining budget:

13.2 minutes

The exact accounting depends on the organization's measurement window and SLO definition.


59. Graceful Degradation Example#

Imagine a video platform.

Critical:

Video playback

Optional:

Recommendations
Comments
Personalized thumbnails

If recommendation service fails:

Playback continues

Fallback:

Trending videos

This is much better than:

Recommendation failure
      ↓
Entire website fails

60. HA Architecture Example#

A practical architecture:

                    Global DNS
                       │
              ┌────────┴────────┐
              │                 │
          Region A           Region B
              │                 │
        Load Balancer      Load Balancer
          /    \             /    \
         ▼      ▼           ▼      ▼
       App A   App B      App C   App D
         │      │           │      │
         └──┬───┘           └──┬───┘
            │                  │
          Cache              Cache
            │                  │
            └──────┬───────────┘
                   │
             Replicated DB

This architecture can survive more failures than a single-server design, but the exact guarantees depend on replication and failover configuration.


61. HA Design Process#

When designing a highly available system:

Step 1#

Identify critical components.

Step 2#

Identify failure domains.

Step 3#

Remove single points of failure.

Step 4#

Add redundancy.

Step 5#

Add health checks.

Step 6#

Design failover.

Step 7#

Define RTO and RPO.

Step 8#

Add graceful degradation.

Step 9#

Protect against cascading failures.

Step 10#

Test failure scenarios.


62. Failure-Oriented Design#

Do not only ask:

How does the system work when everything is healthy?

Also ask:

What if:
Server fails?
Database fails?
Cache fails?
Queue fails?
Network fails?
Zone fails?
Region fails?
Dependency slows?
Traffic doubles?
Deployment fails?
Configuration is wrong?

This mindset is central to production system design.


63. Chaos Engineering#

Chaos engineering deliberately introduces failures to test resilience.

Examples:

Kill server
Introduce latency
Drop network packets
Terminate instances
Fail a dependency
Simulate zone outage

The goal is not to break systems randomly.

The goal is to validate:

Expected failure
    ↓
Expected response
    ↓
Service remains within SLO

64. Common Misconception #1#

Wrong#

High availability means zero downtime.

No.

HA reduces downtime and improves resilience.

No practical system can assume that every failure will be invisible.


65. Common Misconception #2#

Wrong#

More replicas automatically make a system highly available.

Not necessarily.

If all replicas share one failure domain:

Same zone
Same network
Same deployment

one failure can still remove them all.


66. Common Misconception #3#

Wrong#

Active-active is always better than active-passive.

Not necessarily.

Active-active can increase:

  • consistency complexity
  • operational complexity
  • conflict resolution requirements

The architecture should match requirements.


67. Common Misconception #4#

Wrong#

Automatic failover is always safer.

Automation can fail too.

Poorly designed failover can cause:

  • false promotion
  • split brain
  • cascading failures
  • unnecessary failovers

Failover must be carefully designed and tested.


68. Common Misconception #5#

Wrong#

Five nines means the system never fails.

No.

It means the defined service has a very small allowed unavailability budget over the measurement period.

The exact SLO definition matters.


69. Interview Question: What Is High Availability?#

Answer#

High availability is the ability of a system to continue providing its intended service despite component failures. It is achieved using redundancy, failure detection, failover, fault isolation, graceful degradation, and appropriate capacity across failure domains.


70. Interview Question: Active-Active vs Active-Passive#

Answer#

Active-active has multiple instances serving traffic simultaneously, while active-passive keeps one or more standby instances that take over after failure. Active-active can improve utilization and failover speed but usually introduces greater state and coordination complexity.


71. Interview Question: What Is RTO?#

Answer#

Recovery Time Objective defines how quickly a service should be restored after a failure.


72. Interview Question: What Is RPO?#

Answer#

Recovery Point Objective defines how much data loss is acceptable after a failure or disaster.


73. Interview Question: How Do You Remove a SPOF?#

Answer with a process:

Identify component
      ↓
Add redundancy
      ↓
Separate failure domains
      ↓
Add health checks
      ↓
Implement failover
      ↓
Test failure

Example:

Single DB
   ↓
Primary + replicas
   ↓
Multi-AZ
   ↓
Automatic failover

74. Interview Question: How Do You Prevent Cascading Failures?#

Use:

  • timeouts
  • circuit breakers
  • bulkheads
  • rate limits
  • backpressure
  • load shedding
  • bounded queues
  • retries with exponential backoff and jitter
  • dependency isolation
  • graceful degradation

75. Mini Project#

Design a Highly Available E-Commerce Platform#

Requirements:

  • 10 million users
  • Multiple application servers
  • Multiple availability zones
  • Highly available database
  • Cache
  • Message queue
  • Payment dependency
  • Search dependency
  • Product catalog
  • Order system

Design:

                   Global Router
                  /             \
                 ▼               ▼
             Region A         Region B
                │                 │
           Load Balancer     Load Balancer
             /     \           /     \
            ▼       ▼         ▼       ▼
          App A   App B     App C   App D
             │       │         │       │
             └──┬────┘         └──┬────┘
                │                 │
              Cache             Cache
                │                 │
                └───────┬─────────┘
                        │
                   Database
                        │
                     Queue
                        │
                     Workers

For every major component define:

Failure
↓
Detection
↓
Failover
↓
Fallback
↓
Recovery

76. Advanced HA Exercise#

Suppose:

Normal traffic = 100,000 req/sec

You deploy:

4 application servers

Each supports:

30,000 req/sec

Total capacity:

120,000 req/sec

Now one server fails.

Remaining capacity:

90,000 req/sec

Normal traffic:

100,000 req/sec

Therefore the system cannot maintain normal capacity after one failure.

A better design may require:

N+1 capacity

rather than merely N instances.


77. Production HA Checklist#

Before calling a system highly available, ask:

  • Are there single points of failure?
  • Are application servers redundant?
  • Are replicas spread across failure domains?
  • Is the database highly available?
  • Is the cache failure-tolerant?
  • Is the message queue redundant?
  • Are load balancers redundant?
  • Are health checks correct?
  • Is readiness separate from liveness?
  • Is failover automated where appropriate?
  • Is stale leadership prevented?
  • What are the RTO and RPO?
  • What is the SLO?
  • Is there enough N+1 capacity?
  • What happens during traffic spikes?
  • What happens when dependencies fail?
  • Are circuit breakers configured?
  • Are retries bounded?
  • Is graceful degradation implemented?
  • Is there a disaster recovery plan?
  • Have failure scenarios been tested?

78. Final Mental Model#

High availability can be remembered as:

              HIGH AVAILABILITY
                     │
       ┌─────────────┼─────────────┐
       │             │             │
   Redundancy     Detection     Recovery
       │             │             │
       ▼             ▼             ▼
 Multiple        Health checks   Failover
 instances       Heartbeats      Retry
 AZs             Monitoring      Recovery
 Regions                         Degradation
       │
       ▼
 Failure isolation
       │
       ▼
 Cascading failure protection
       │
       ▼
 Capacity + Testing

The core principle is:

Assume components will fail; design the system so that one failure does not unnecessarily become a service outage.


79. Summary#

You learned:

  • High availability
  • Availability vs reliability
  • Availability calculations
  • MTBF
  • MTTR
  • Nines
  • SLA
  • SLO
  • SLI
  • Redundancy
  • Single points of failure
  • Failure domains
  • Availability zones
  • Multi-AZ architecture
  • Active-active
  • Active-passive
  • Stateless services
  • Load balancer HA
  • Health checks
  • Liveness vs readiness
  • Graceful degradation
  • Dependency isolation
  • Cascading failures
  • Circuit breakers
  • Bulkheads
  • Load shedding
  • Backpressure
  • Retry storms
  • Exponential backoff and jitter
  • Database HA
  • Synchronous vs asynchronous replication
  • Database failover
  • RPO
  • RTO
  • Disaster recovery
  • Multi-region architecture
  • Deployment strategies
  • Rolling deployment
  • Blue-green deployment
  • Canary deployment
  • Caching for availability
  • Queues for resilience
  • N+1 / N+2 redundancy
  • Availability math
  • Correlated failures
  • Blast radius
  • Error budgets
  • Chaos engineering
  • HA interview questions
  • HA system-design project

The most important takeaway:

High availability is not a single technology. It is an architectural property created by redundancy, failure detection, failover, isolation, capacity planning, graceful degradation, and continuous failure testing.


80. Exercises#

Exercise 1#

Calculate approximate annual downtime for:

99.9%
99.99%
99.999%

Exercise 2#

Explain:

MTBF vs MTTR

Exercise 3#

Design an active-active application across three availability zones.

Exercise 4#

Identify all SPOFs in:

Client
  ↓
Load Balancer
  ↓
Server
  ↓
Database

Exercise 5#

Explain how a circuit breaker prevents cascading failures.

Exercise 6#

Design an N+1 architecture for:

100,000 req/sec

when one server can process:

25,000 req/sec

Exercise 7#

Explain:

RPO vs RTO

using a banking example.


81. Next Chapter#

Chapter 28 — Fault Tolerance#

Next we will go deeper into fault tolerance.

We will study:

  • Fault tolerance vs high availability
  • Failure types
  • Crash failures
  • Network failures
  • Byzantine failures
  • Fault domains
  • Redundancy
  • Replication
  • Failover
  • Retries
  • Timeouts
  • Circuit breakers
  • Bulkheads
  • Backpressure
  • Load shedding
  • Graceful degradation
  • Self-healing systems
  • Recovery mechanisms
  • Fault injection
  • Chaos engineering
  • Failure budgets
  • Designing for partial failure
  • Real-world fault-tolerant architecture
  • Interview questions
  • Fault-tolerance design exercise

Finished this chapter?

Mark it as complete to track your mastery.

Previous ChapterChapter 26 — Distributed CoordinationNext ChapterChapter 28 — Fault Tolerance
PrevNext