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 31 of 33
30.
Phase 06Read time ~28 minDifficulty advanced

Disaster Recovery

In this chapter
  • 01Introduction
  • 02What Is Disaster Recovery?
  • 03Disaster Recovery vs Fault Tolerance
  • 04Why DR Is Necessary
  • 05Types of Disasters
  • 06Infrastructure Failure
  • 07Data Center Failure
  • 08Regional Failure
  • 09Data Corruption
  • 10Accidental Deletion
  • 11Security Incidents
  • 12Application-Level Disaster
  • 13Business Impact Analysis
  • 14Payment System
  • 15Internal Analytics Dashboard
  • 16RPO — Recovery Point Objective
  • 17Example
  • 18RTO — Recovery Time Objective
  • 19RPO vs RTO
  • 20Backups
  • 21Full Backups
  • 22Incremental Backups
  • 23Differential Backups
  • 24Snapshot-Based Recovery
  • 25Point-in-Time Recovery
  • 26Replication vs Backup
  • 27Backup Retention
  • 28The 3-2-1 Backup Principle
  • 29Immutable Backups
  • 30Backup Encryption
  • 31Restore Testing
  • 32Recovery Drill
  • 33Cold, Warm, and Hot Standby
  • 34Cold Standby
  • 35Warm Standby
  • 36Hot Standby
  • 37Active-Passive DR
  • 38Active-Active DR
  • 39Cross-Region Database Replication
  • 40Synchronous vs Asynchronous Cross-Region Replication
  • 41Synchronous
  • 42Asynchronous
  • 43Global Traffic Failover
  • 44DNS Failover
  • 45DR Runbooks
  • 46Why Runbooks Matter
  • 47Disaster Recovery Dependencies
  • 48Dependency Mapping
  • 49Recovery Order
  • 50Business Continuity
  • 51DR Architecture Example
  • 52DR for a Payment System
  • 53Data Recovery vs Service Recovery
  • 54Service recovery
  • 55Data recovery
  • 56Recovery Validation
  • 57Infrastructure
  • 58Application
  • 59Data
  • 60Business workflows
  • 61Recovery Testing Levels
  • 62Tabletop Exercise
  • 63Simulation
  • 64Failover Test
  • 65Full Disaster Exercise
  • 66Common DR Testing Problems
  • 67DR Metrics
  • 68RPO achieved
  • 69RTO achieved
  • 70Backup success rate
  • 71Restore success rate
  • 72Replication lag
  • 73Recovery validation success
  • 74Common DR Mistakes
  • 75Mistake 1 — Thinking replication is backup
  • 76Mistake 2 — Never testing restores
  • 77Mistake 3 — Keeping backups in the same failure domain
  • 78Mistake 4 — Ignoring data corruption
  • 79Mistake 5 — Recovering infrastructure but forgetting dependencies
  • 80Mistake 6 — No documented runbook
  • 81Mistake 7 — Ignoring RPO/RTO
  • 82Mistake 8 — Making DR too expensive
  • 83Mistake 9 — Assuming failover is automatic
  • 84Mistake 10 — No rollback/recovery plan after failover
  • 85DR Design Decision Framework
  • 86Choosing a DR Strategy
  • 87Disaster Recovery Architecture Layers
  • 88Example: Small Startup
  • 89Example: Large E-Commerce Platform
  • 90Infrastructure as Code and DR
  • 91DR and Secrets
  • 92DR and Queues
  • 93DR and Object Storage
  • 94DR and Kubernetes
  • 95DR and Observability
  • 96Disaster Recovery Runbook Example
  • 97Interview Questions
  • 98Beginner
  • 99What is Disaster Recovery?
  • 100What is RPO?
  • 101What is RTO?
  • 102Is replication a backup?
  • 103What is a cold standby?
  • 104Intermediate
  • 105What is the difference between active-active and active-passive?
  • 106Why are backups tested?
  • 107Why use cross-region backups?
  • 108What is point-in-time recovery?
  • 109Why can replication fail to protect against corruption?
  • 110Advanced
  • 111How would you design DR for a payment system?
  • 112How do you choose between warm and hot standby?
  • 113How do you prevent ransomware from destroying backups?
  • 114How do you recover from database corruption?
  • 115What makes a DR plan production-ready?
  • 116Mini Project — Design a Disaster Recovery System
  • 117Your architecture should include
  • 118Application
  • 119Database
  • 120Backups
  • 121Traffic
  • 122Recovery
  • 123Questions to answer
  • 124Production DR Checklist
  • 125Business
  • 126Data
  • 127Infrastructure
  • 128Application
  • 129Operations
  • 130Testing
  • 131Key Mental Models
  • 132Replication is not backup
  • 133RPO is about data
  • 134RTO is about time
  • 135Recovery must include dependencies
  • 136Backups must be restorable
  • 137Data correctness matters
  • 138DR is a process, not a server
  • 139Summary
  • 140Exercises
  • 141Exercise 1
  • 142Exercise 2
  • 143Exercise 3
  • 144Exercise 4
  • 145Exercise 5
  • 146Final Takeaway
  • 147Next Chapter
  • 148Chapter 30 — System Design Security Fundamentals
In this chapter (148 sections)
01Introduction02What Is Disaster Recovery?03Disaster Recovery vs Fault Tolerance04Why DR Is Necessary05Types of Disasters06Infrastructure Failure07Data Center Failure08Regional Failure09Data Corruption10Accidental Deletion11Security Incidents12Application-Level Disaster13Business Impact Analysis14Payment System15Internal Analytics Dashboard16RPO — Recovery Point Objective17Example18RTO — Recovery Time Objective19RPO vs RTO20Backups21Full Backups22Incremental Backups23Differential Backups24Snapshot-Based Recovery25Point-in-Time Recovery26Replication vs Backup27Backup Retention28The 3-2-1 Backup Principle29Immutable Backups30Backup Encryption31Restore Testing32Recovery Drill33Cold, Warm, and Hot Standby34Cold Standby35Warm Standby36Hot Standby37Active-Passive DR38Active-Active DR39Cross-Region Database Replication40Synchronous vs Asynchronous Cross-Region Replication41Synchronous42Asynchronous43Global Traffic Failover44DNS Failover45DR Runbooks46Why Runbooks Matter47Disaster Recovery Dependencies48Dependency Mapping49Recovery Order50Business Continuity51DR Architecture Example52DR for a Payment System53Data Recovery vs Service Recovery54Service recovery55Data recovery56Recovery Validation57Infrastructure58Application59Data60Business workflows61Recovery Testing Levels62Tabletop Exercise63Simulation64Failover Test65Full Disaster Exercise66Common DR Testing Problems67DR Metrics68RPO achieved69RTO achieved70Backup success rate71Restore success rate72Replication lag73Recovery validation success74Common DR Mistakes75Mistake 1 — Thinking replication is backup76Mistake 2 — Never testing restores77Mistake 3 — Keeping backups in the same failure domain78Mistake 4 — Ignoring data corruption79Mistake 5 — Recovering infrastructure but forgetting dependencies80Mistake 6 — No documented runbook81Mistake 7 — Ignoring RPO/RTO82Mistake 8 — Making DR too expensive83Mistake 9 — Assuming failover is automatic84Mistake 10 — No rollback/recovery plan after failover85DR Design Decision Framework86Choosing a DR Strategy87Disaster Recovery Architecture Layers88Example: Small Startup89Example: Large E-Commerce Platform90Infrastructure as Code and DR91DR and Secrets92DR and Queues93DR and Object Storage94DR and Kubernetes95DR and Observability96Disaster Recovery Runbook Example97Interview Questions98Beginner99What is Disaster Recovery?100What is RPO?101What is RTO?102Is replication a backup?103What is a cold standby?104Intermediate105What is the difference between active-active and active-passive?106Why are backups tested?107Why use cross-region backups?108What is point-in-time recovery?109Why can replication fail to protect against corruption?110Advanced111How would you design DR for a payment system?112How do you choose between warm and hot standby?113How do you prevent ransomware from destroying backups?114How do you recover from database corruption?115What makes a DR plan production-ready?116Mini Project — Design a Disaster Recovery System117Your architecture should include118Application119Database120Backups121Traffic122Recovery123Questions to answer124Production DR Checklist125Business126Data127Infrastructure128Application129Operations130Testing131Key Mental Models132Replication is not backup133RPO is about data134RTO is about time135Recovery must include dependencies136Backups must be restorable137Data correctness matters138DR is a process, not a server139Summary140Exercises141Exercise 1142Exercise 2143Exercise 3144Exercise 4145Exercise 5146Final Takeaway147Next Chapter148Chapter 30 — System Design Security Fundamentals

1. Introduction#

Disaster Recovery (DR) is the discipline of preparing a system to recover from a major disruptive event and restore critical business operations within an acceptable time.

A production system can be highly available and fault tolerant and still need disaster recovery.

For example:

  • A server can fail and another server can take over.
  • A database node can fail and a replica can become primary.
  • An Availability Zone can become unavailable and traffic can move to another AZ.

Those are normal failure scenarios.

But what happens when:

  • an entire region becomes unavailable?
  • a deployment corrupts millions of records?
  • someone accidentally deletes important data?
  • ransomware encrypts production data?
  • backups themselves are damaged?
  • a major cloud control-plane problem prevents normal operations?
  • an operator makes a destructive change?

That is where Disaster Recovery becomes critical.


2. What Is Disaster Recovery?#

Disaster Recovery is the set of:

  • architecture decisions
  • data protection mechanisms
  • backup strategies
  • replication mechanisms
  • failover procedures
  • recovery procedures
  • runbooks
  • testing processes
  • people and responsibilities

required to restore a system after a major disaster.

A simple model is:

Normal Operation
       |
       v
+----------------+
| Production     |
| Environment    |
+----------------+
       |
       | disaster
       v
+----------------+
| Recovery       |
| Environment    |
+----------------+
       |
       v
Restore Service
       |
       v
Resume Business

DR is therefore not simply:

"Take backups."

It is a complete operational strategy.


3. Disaster Recovery vs Fault Tolerance#

These concepts are related but different.

Concept Main Goal
Fault tolerance Continue operating despite failures
High availability Minimize service downtime
Disaster recovery Recover after a major disaster
Backup Preserve recoverable copies of data
Business continuity Keep critical business operations running

Example:

A server crashes.

Server A
   X
   |
   v
Server B

The load balancer sends traffic to Server B.

That is fault tolerance / high availability.

Now imagine:

Entire Region
     X
     |
     v
Another Region

Moving the workload to another region is a disaster recovery concern.


4. Why DR Is Necessary#

A system can have:

  • multiple servers
  • multiple database replicas
  • load balancers
  • Kubernetes
  • autoscaling
  • monitoring

and still lose data or become unavailable.

Why?

Because redundancy does not protect against every failure.

Consider:

Application
     |
     v
Database
     |
     +---- Replica
     |
     +---- Replica

If an administrator accidentally executes:

DROP TABLE customers;

replication may faithfully replicate the destructive operation.

So:

Replication != Backup

This is one of the most important DR concepts.


5. Types of Disasters#

Disasters can have different causes.

5.1 Infrastructure Failure#

Examples:

  • server failure
  • storage failure
  • networking failure
  • power failure
  • hardware failure

Usually handled partly through HA and redundancy.


5.2 Data Center Failure#

An entire data center may become unavailable.

Examples:

  • power outage
  • cooling failure
  • network failure
  • physical damage

Multi-AZ architectures can reduce this risk.


5.3 Regional Failure#

An entire cloud region may become unavailable.

Example:

Region A
---------
Application
Database
Cache
Storage
 
        X
 
Region B
---------
Recovery Environment

This requires cross-region DR.


5.4 Data Corruption#

Data may become corrupted because of:

  • application bugs
  • bad migrations
  • incorrect scripts
  • software defects
  • operator mistakes

This is especially dangerous because corrupted data can be replicated.


5.5 Accidental Deletion#

Examples:

DELETE FROM users;

or:

rm -rf important-data

or an administrator deletes a production storage bucket.

Backups and retention policies are critical here.


5.6 Security Incidents#

Examples:

  • ransomware
  • compromised credentials
  • destructive attacker activity
  • malicious deletion
  • encryption of production data

DR architecture should consider security isolation for backups.


5.7 Application-Level Disaster#

A software deployment can cause widespread failure.

Example:

Version 1
   |
   v
Version 2
   |
   v
Database migration
   |
   X
Millions of records corrupted

Rollback alone may not recover corrupted data.

Point-in-time recovery may be required.


6. Business Impact Analysis#

Before designing DR, understand what the business actually needs.

Not every system requires the same recovery objective.

Consider two systems:

Payment System#

Downtime may immediately stop transactions.

Internal Analytics Dashboard#

Several hours of downtime may be acceptable.

Therefore DR requirements should be driven by business impact.

Important questions:

  1. What services are business critical?
  2. How much data can we afford to lose?
  3. How long can the service remain unavailable?
  4. What dependencies are required for recovery?
  5. What is the acceptable recovery cost?
  6. What compliance requirements exist?

7. RPO — Recovery Point Objective#

RPO answers:

How much data loss can the business tolerate?

Suppose:

10:00 ---- 11:00 ---- 12:00 ---- Disaster

If RPO is 1 hour, losing approximately the latest hour of data may be acceptable.

If RPO is 5 minutes, the recovery architecture must preserve data much more frequently.

Example#

A payment system:

RPO = near zero

A reporting system:

RPO = 24 hours

RPO is fundamentally about data loss tolerance.


8. RTO — Recovery Time Objective#

RTO answers:

How long can the system remain unavailable?

Example:

Disaster occurs
      |
      | 15 minutes
      v
Service restored

Then:

RTO = 15 minutes

RTO is fundamentally about downtime tolerance.


9. RPO vs RTO#

Property RPO RTO
Meaning Maximum acceptable data loss Maximum acceptable downtime
Focus Data Time
Question How much data can we lose? How quickly must we recover?

Example:

RPO = 5 minutes
RTO = 30 minutes

Means:

  • recover within 30 minutes
  • lose no more than approximately 5 minutes of data

10. Backups#

A backup is a separate recoverable copy of data.

Basic model:

Production
    |
    v
Backup System
    |
    v
Backup Storage

Good backup systems consider:

  • frequency
  • retention
  • encryption
  • isolation
  • geographic separation
  • restore speed
  • restore testing

11. Full Backups#

A full backup copies the entire dataset.

Example:

Monday
  Full Backup
 
Tuesday
  Full Backup
 
Wednesday
  Full Backup

Advantages:

  • simple restore
  • independent backup copies

Disadvantages:

  • expensive
  • time consuming
  • high storage consumption

12. Incremental Backups#

An incremental backup stores changes since the previous backup.

Example:

Sunday
Full Backup
 
Monday
Changes since Sunday
 
Tuesday
Changes since Monday
 
Wednesday
Changes since Tuesday

Advantages:

  • lower storage usage
  • faster backup operations

Disadvantages:

  • restoration may require multiple backup pieces
  • dependency chain can become complicated

13. Differential Backups#

A differential backup stores changes since the last full backup.

Example:

Sunday
Full
 
Monday
Changes since Sunday
 
Tuesday
Changes since Sunday
 
Wednesday
Changes since Sunday

Restore generally requires:

Full backup
+
Latest differential

14. Snapshot-Based Recovery#

A snapshot captures the state of storage at a point in time.

Conceptually:

Database Volume
      |
      +---- Snapshot T1
      |
      +---- Snapshot T2
      |
      +---- Snapshot T3

Snapshots can be useful for:

  • fast recovery
  • cloning
  • rollback
  • testing

But snapshots should not automatically be treated as a complete DR strategy.

If snapshots exist only inside the same failure domain, a larger infrastructure failure may affect them too.


15. Point-in-Time Recovery#

Point-in-time recovery allows restoring data to a selected point in time.

A common architecture is:

Base Backup
     +
Transaction Logs / WAL
     |
     v
Target Recovery Time

For example:

12:00 backup
12:05 transaction log
12:10 transaction log
12:15 transaction log
12:20 bad deployment

You may restore to:

12:19

instead of restoring only to 12

.

This is extremely useful for:

  • accidental deletion
  • bad migrations
  • application bugs
  • corrupted writes

16. Replication vs Backup#

This distinction is critical.

Replication:

Primary
   |
   v
Replica

Backup:

Primary
   |
   v
Independent Recovery Copy

Replication improves availability.

Backups improve recoverability.

A replica can contain the same corrupted data as the primary.

A backup may preserve a historical clean state.

Therefore:

HA + Replication + Backup

is stronger than any one of them alone.


17. Backup Retention#

Backups should not be kept indefinitely without a policy.

A retention policy might be:

Hourly   -> 48 hours
Daily    -> 30 days
Weekly   -> 12 weeks
Monthly  -> 7 years

The exact policy depends on:

  • business requirements
  • compliance
  • cost
  • recovery requirements

18. The 3-2-1 Backup Principle#

A commonly used backup strategy is:

3 copies of data
2 different storage/media types
1 copy off-site

Conceptually:

Production
    |
    +---- Local backup
    |
    +---- Secondary storage
    |
    +---- Off-site backup

The principle reduces dependence on a single failure domain.

For modern cloud systems, the exact implementation can vary, but the underlying idea remains useful:

Do not let one disaster destroy every copy.


19. Immutable Backups#

A backup can be protected from modification or deletion for a defined period.

Conceptually:

Backup
   |
   v
Immutable Storage
   |
   X
Cannot be modified during retention period

This can protect against:

  • ransomware
  • compromised credentials
  • accidental deletion
  • malicious administrators

The important principle is:

A backup that an attacker can immediately delete may not be a reliable recovery boundary.


20. Backup Encryption#

Backups may contain sensitive information.

Therefore protect:

  • data at rest
  • data in transit
  • backup credentials
  • encryption keys
  • access policies

A strong design separates backup access from normal production access where practical.


21. Restore Testing#

One of the biggest DR mistakes is:

"We have backups, therefore we can recover."

A backup is useful only if it can actually be restored.

A DR program should test:

Backup
  |
  v
Restore
  |
  v
Validate
  |
  v
Application starts
  |
  v
Data verified

22. Recovery Drill#

A recovery drill simulates a disaster.

Example:

Scenario:
Primary region unavailable

Team performs:

  1. declare incident
  2. identify recovery environment
  3. restore or activate infrastructure
  4. recover database
  5. restore application
  6. configure traffic routing
  7. validate critical workflows
  8. monitor
  9. communicate recovery status

The goal is to discover gaps before a real disaster.


23. Cold, Warm, and Hot Standby#

DR environments can be classified by how ready they are.

Cold Standby#

Infrastructure is mostly absent or minimally prepared.

Primary Region
   |
   X
   |
   v
Recovery Region
   |
Provision infrastructure
   |
Restore data
   |
Start services

Advantages:

  • lower cost

Disadvantages:

  • slower recovery
  • larger operational dependency

24. Warm Standby#

A recovery environment is partially running.

Primary Region
   |
   | replication
   v
Warm Region
   |
small running capacity

During disaster:

Scale up
+
Promote database
+
Route traffic

This provides a balance between cost and recovery speed.


25. Hot Standby#

The recovery environment is already running.

Region A
========
Application
Database
Cache
 
       |
       | replication
       v
 
Region B
========
Application
Database
Cache

Failover can be relatively fast.

But it is expensive and operationally complex.


26. Active-Passive DR#

In active-passive architecture:

             Traffic
                |
                v
        +---------------+
        | Region A      |
        | ACTIVE        |
        +---------------+
                |
           replication
                |
                v
        +---------------+
        | Region B      |
        | PASSIVE       |
        +---------------+

During failure:

Region A
   X
   |
   v
Promote Region B
   |
   v
Route traffic

27. Active-Active DR#

Both regions serve traffic.

             Users
               |
        Global Traffic
          Distribution
          /           \
         v             v
     Region A       Region B
     ACTIVE         ACTIVE

Advantages:

  • better resource utilization
  • lower failover dependency
  • traffic can continue in another region

Challenges:

  • data consistency
  • conflict resolution
  • distributed state
  • operational complexity

28. Cross-Region Database Replication#

A DR architecture often needs data in another region.

Example:

Region A
Primary DB
    |
    | async replication
    v
Region B
Standby DB

Asynchronous replication introduces a possible RPO gap.

If:

Primary writes:
A
B
C
D
 
Replica receives:
A
B
C

and the primary region fails, D may be lost.

Therefore replication strategy must be matched to the RPO requirement.


29. Synchronous vs Asynchronous Cross-Region Replication#

Synchronous#

A write may require acknowledgement from multiple locations.

Advantages:

  • lower potential data loss

Disadvantages:

  • latency
  • network dependency
  • complexity

Asynchronous#

The primary confirms the write before the remote copy necessarily receives it.

Advantages:

  • lower write latency
  • better geographic independence

Disadvantages:

  • replication lag
  • potential data loss

There is a trade-off:

Consistency / RPO
        vs
Latency / Availability

30. Global Traffic Failover#

When the primary region fails, traffic needs to reach the recovery environment.

Common mechanisms include:

  • DNS-based failover
  • global load balancing
  • application-level routing
  • anycast/global edge routing

Conceptually:

Users
  |
  v
Global Traffic Manager
  |
  +------ Region A
  |
  +------ Region B

During failure:

Region A = unhealthy
 
Traffic
   |
   v
Region B

31. DNS Failover#

DNS can direct clients toward a healthy endpoint.

Example:

app.example.com
       |
       v
DNS
   /       \
Region A  Region B

If Region A becomes unhealthy:

DNS
 |
 v
Region B

However, DNS failover is not instantaneous.

Caching and TTL behavior can influence how quickly clients observe the change.


32. DR Runbooks#

A runbook is a documented sequence of operational actions.

A DR runbook might contain:

1. Declare disaster
2. Assign incident commander
3. Confirm affected region
4. Freeze dangerous changes
5. Validate recovery environment
6. Promote database
7. Scale application
8. Update traffic routing
9. Validate critical workflows
10. Monitor error rates
11. Communicate status
12. Begin recovery of primary region

The exact commands depend on the infrastructure.


33. Why Runbooks Matter#

During a major incident:

  • people are under pressure
  • multiple teams are involved
  • communication becomes difficult
  • memory is unreliable
  • unusual failures occur

A documented runbook reduces dependency on individual knowledge.

Good runbooks include:

  • prerequisites
  • commands
  • decision points
  • rollback conditions
  • validation steps
  • owners
  • escalation paths

34. Disaster Recovery Dependencies#

A common mistake is recovering only the application.

Imagine:

Application
   |
   +---- Database
   |
   +---- Authentication
   |
   +---- Payment provider
   |
   +---- Object storage
   |
   +---- DNS
   |
   +---- Secrets
   |
   +---- Message queue

If the application is restored but authentication is unavailable, the system may still be unusable.

Therefore DR planning must identify dependencies.


35. Dependency Mapping#

Create a dependency graph:

User
 |
 v
DNS
 |
 v
Load Balancer
 |
 v
Application
 |
 +---- Database
 |
 +---- Cache
 |
 +---- Queue
 |
 +---- Object Storage
 |
 +---- Authentication
 |
 +---- External APIs

Then ask:

Can every critical dependency recover?


36. Recovery Order#

Recovery should follow dependency order.

For example:

1. Networking
2. DNS / traffic management
3. Identity / secrets
4. Database
5. Object storage
6. Message infrastructure
7. Application services
8. Background workers
9. Analytics / non-critical systems

The exact order varies by architecture.


37. Business Continuity#

Disaster recovery is part of a broader concept called Business Continuity.

Business continuity asks:

How does the organization continue critical operations during disruption?

This includes:

  • technology
  • employees
  • communication
  • facilities
  • suppliers
  • customers
  • operational processes

DR focuses heavily on technology recovery, while business continuity has a broader organizational scope.


38. DR Architecture Example#

Consider an e-commerce system.

                         Users
                           |
                           v
                 Global Traffic Manager
                    /               \
                   v                 v
             Region A             Region B
             ACTIVE               STANDBY
                |                    |
        +-------+-------+            |
        |       |       |            |
       API    Queue    Cache         |
        |                    replication
        v                         |
     Primary DB ------------------+
        |
        v
   Object Storage
        |
        v
Cross-region backup

During normal operation:

Region A = primary
Region B = recovery

During disaster:

Region A
   X
 
Global Traffic
      |
      v
Region B
      |
      v
Promote database
      |
      v
Scale services
      |
      v
Validate application

39. DR for a Payment System#

Payments require special care because duplicate processing can be dangerous.

Suppose:

User pays ₹1,000

The request succeeds at the payment provider, but the application crashes before recording the result.

A retry could accidentally create another payment.

Therefore DR architecture should include:

  • idempotency keys
  • durable transaction records
  • reconciliation
  • payment-provider status lookup
  • audit logs
  • durable event storage

Recovery should not simply replay every request blindly.


40. Data Recovery vs Service Recovery#

These are different.

Service recovery#

Application becomes available

Data recovery#

Correct data state is restored

A system can be:

UP but WRONG

That is still a serious disaster.

For example:

Application = HTTP 200
Database = corrupted

Therefore DR validation must verify correctness, not merely process availability.


41. Recovery Validation#

After recovery, validate:

Infrastructure#

  • instances healthy
  • networking healthy
  • storage mounted

Application#

  • health checks passing
  • APIs responding
  • queues processing

Data#

  • expected record counts
  • consistency checks
  • recent transactions present
  • no obvious corruption

Business workflows#

  • login
  • checkout
  • payment
  • order creation
  • notification

Business-level validation is essential.


42. Recovery Testing Levels#

DR testing can range from simple to highly realistic.

Tabletop Exercise#

Teams discuss:

"What would we do if Region A disappeared?"

Low risk.


Simulation#

Teams execute portions of the recovery procedure.


Failover Test#

Traffic is actually moved.


Full Disaster Exercise#

A realistic disaster scenario is executed with production-like conditions.

Higher realism means higher risk, so testing must be carefully controlled.


43. Common DR Testing Problems#

A recovery test may reveal:

  • expired credentials
  • missing infrastructure
  • broken automation
  • incorrect DNS configuration
  • incomplete backups
  • missing secrets
  • replication lag
  • undocumented dependencies
  • insufficient capacity
  • broken restore procedures

This is exactly why testing matters.


44. DR Metrics#

Useful metrics include:

RPO achieved#

Actual data loss during test

Compare against target RPO.

RTO achieved#

Actual recovery time

Compare against target RTO.

Backup success rate#

successful backups / total backups

Restore success rate#

successful restores / restore attempts

Replication lag#

Primary time - Replica time

Recovery validation success#

Percentage of critical workflows that work after recovery.


45. Common DR Mistakes#

Mistake 1 — Thinking replication is backup#

It is not.


Mistake 2 — Never testing restores#

Untested backups are assumptions.


Mistake 3 — Keeping backups in the same failure domain#

A regional disaster can affect both production and backups.


Mistake 4 — Ignoring data corruption#

Availability does not guarantee correctness.


Mistake 5 — Recovering infrastructure but forgetting dependencies#

Application recovery is not enough.


Mistake 6 — No documented runbook#

People may not know what to do during the incident.


Mistake 7 — Ignoring RPO/RTO#

Without measurable objectives, DR architecture cannot be evaluated properly.


Mistake 8 — Making DR too expensive#

A system should match DR investment to business requirements.


Mistake 9 — Assuming failover is automatic#

Automatic failover itself needs testing.


Mistake 10 — No rollback/recovery plan after failover#

After the immediate disaster, the organization still needs a controlled path back to normal operations.


46. DR Design Decision Framework#

When designing DR, ask:

1. What can fail?
2. What is the business impact?
3. What RPO is required?
4. What RTO is required?
5. Which data needs backup?
6. Where should backups live?
7. How frequently should backups occur?
8. How long should backups be retained?
9. How is data restored?
10. How is traffic redirected?
11. What dependencies must recover?
12. Who owns each recovery step?
13. How is recovery tested?
14. How is recovery validated?
15. What happens after recovery?

47. Choosing a DR Strategy#

A simplified decision model:

Requirement Possible Strategy
Low cost, long recovery Cold standby
Moderate recovery requirement Warm standby
Fast recovery Hot standby
Very low RPO Frequent/synchronous replication where appropriate
Historical recovery Backups + point-in-time recovery
Regional resilience Cross-region architecture
High traffic continuity Active-active

The architecture must be derived from the required RPO, RTO, business impact, and budget.


48. Disaster Recovery Architecture Layers#

Think of DR as multiple layers.

+------------------------------+
| Business Continuity          |
+------------------------------+
| DR Runbooks & Operations     |
+------------------------------+
| Traffic Failover             |
+------------------------------+
| Application Recovery         |
+------------------------------+
| Data Recovery                |
+------------------------------+
| Backup / Replication         |
+------------------------------+
| Infrastructure Recovery      |
+------------------------------+

A mature DR strategy addresses all layers.


49. Example: Small Startup#

Requirements:

RPO = 24 hours
RTO = 4 hours

A reasonable approach could be:

Primary
  |
  +---- Daily backups
  |
  +---- Off-site backup
  |
  +---- Infrastructure as Code
  |
  +---- Documented restore procedure

The startup does not necessarily need two fully active regions.


50. Example: Large E-Commerce Platform#

Requirements:

RPO = minutes or lower
RTO = minutes

Potential architecture:

Global Traffic
       |
 +-----+------+
 |            |
Region A    Region B
Active      Active/Standby
 |            |
DB ---------- DB
 |            |
Backups     Backups

Additional mechanisms:

  • cross-region replication
  • automated failover
  • immutable backups
  • continuous monitoring
  • regular recovery exercises

51. Infrastructure as Code and DR#

Infrastructure as Code can make recovery easier.

Instead of manually rebuilding:

Server
Database
Load Balancer
Network
IAM
Queues

configuration can be represented as code.

Conceptually:

Infrastructure Code
       |
       v
Recovery Region
       |
       v
Rebuild Infrastructure

But IaC alone is not DR.

It does not automatically solve:

  • data recovery
  • application state
  • secrets
  • external dependencies
  • traffic failover
  • validation

52. DR and Secrets#

Recovery environments need access to:

  • database credentials
  • API keys
  • encryption keys
  • certificates
  • service credentials

A common disaster is:

Application restored
      |
      v
Secret unavailable
      |
      v
Application cannot start

Secrets therefore need their own recovery strategy.


53. DR and Queues#

Queues require special consideration.

Suppose:

Producer
   |
   v
Queue
   |
   v
Worker

During disaster:

  • Are messages replicated?
  • Can they be replayed?
  • Could they be processed twice?
  • Are consumers idempotent?
  • Is message ordering required?
  • What happens to delayed messages?

DR design must preserve the semantics of the messaging system.


54. DR and Object Storage#

Object storage often contains:

  • images
  • documents
  • videos
  • backups
  • exports

Consider:

Primary Bucket
      |
      v
Replication
      |
      v
Recovery Bucket

Also consider:

  • versioning
  • lifecycle rules
  • retention
  • immutability
  • encryption
  • access control

55. DR and Kubernetes#

Kubernetes can recreate application infrastructure, but Kubernetes itself does not magically recover application state.

A recovery strategy may involve:

Git / IaC
   +
Container Registry
   +
Kubernetes Manifests
   +
Cluster Recovery
   +
Database Recovery
   +
Object Storage Recovery
   +
Secrets Recovery

The cluster is only one component of the system.


56. DR and Observability#

During recovery, observability is essential.

Monitor:

  • request rate
  • error rate
  • latency
  • database health
  • replication lag
  • queue depth
  • resource utilization
  • recovery progress
  • business transactions

A recovery system without visibility is difficult to operate safely.


57. Disaster Recovery Runbook Example#

INCIDENT: Primary Region Failure
 
Phase 1 — Detection
1. Confirm outage.
2. Check monitoring.
3. Verify regional scope.
 
Phase 2 — Decision
4. Declare DR event.
5. Assign incident commander.
6. Freeze non-essential changes.
 
Phase 3 — Data
7. Check replication status.
8. Determine latest recoverable point.
9. Promote recovery database.
 
Phase 4 — Infrastructure
10. Scale recovery environment.
11. Validate dependencies.
12. Load secrets/configuration.
 
Phase 5 — Traffic
13. Shift traffic.
14. Validate health checks.
 
Phase 6 — Validation
15. Test login.
16. Test read operations.
17. Test write operations.
18. Test critical business workflows.
 
Phase 7 — Stabilization
19. Monitor metrics.
20. Communicate status.
21. Start primary-region recovery.
 
Phase 8 — Post-Incident
22. Reconcile data.
23. Review RPO/RTO.
24. Document lessons.
25. Improve runbook.

58. Interview Questions#

Beginner#

1. What is Disaster Recovery?#

DR is the strategy and set of processes used to recover systems and business operations after major disruption.

2. What is RPO?#

Maximum acceptable data loss measured in time.

3. What is RTO?#

Maximum acceptable downtime before service recovery.

4. Is replication a backup?#

No. Replication primarily supports availability and continuity; backups provide historical recovery points.

5. What is a cold standby?#

A recovery environment that requires significant preparation before becoming operational.


Intermediate#

6. What is the difference between active-active and active-passive?#

Active-active has multiple environments serving traffic, while active-passive keeps one environment primarily as a standby.

7. Why are backups tested?#

Because successful backup creation does not guarantee successful restoration.

8. Why use cross-region backups?#

To protect against failures affecting the primary geographic failure domain.

9. What is point-in-time recovery?#

Recovery of data to a selected historical point using backups and transaction/log information.

10. Why can replication fail to protect against corruption?#

Because the corruption can be replicated to the secondary copy.


Advanced#

11. How would you design DR for a payment system?#

Discuss:

  • RPO/RTO
  • multi-region architecture
  • durable transaction records
  • idempotency
  • replication
  • backups
  • point-in-time recovery
  • reconciliation
  • traffic failover
  • audit logs
  • recovery validation

12. How do you choose between warm and hot standby?#

Based on required RTO, RPO, cost, operational complexity, and business impact.

13. How do you prevent ransomware from destroying backups?#

Consider:

  • immutable backups
  • isolated credentials
  • separate access controls
  • retention policies
  • offline or logically isolated copies
  • restore testing

14. How do you recover from database corruption?#

Possible strategy:

Detect corruption
      |
Identify clean recovery point
      |
Restore backup
      |
Replay logs to target point
      |
Validate data
      |
Recover application
      |
Reconcile missing/new transactions

15. What makes a DR plan production-ready?#

It must be:

  • documented
  • automated where appropriate
  • tested
  • measurable
  • observable
  • dependency-aware
  • owned by responsible teams
  • aligned with RPO/RTO

59. Mini Project — Design a Disaster Recovery System#

Design DR for:

E-Commerce Platform

Requirements:

Users: 10 million
Daily orders: 2 million
RPO: 5 minutes
RTO: 30 minutes
Primary region: Region A
Recovery region: Region B

Your architecture should include#

Application#

Region A
   |
Application Cluster

Database#

Primary DB
    |
    v
Cross-region Replica

Backups#

Continuous / frequent logs
+
Daily full backups
+
Immutable retention

Traffic#

Global Traffic Manager
       |
   +---+---+
   |       |
Region A Region B

Recovery#

Failure
  |
  v
Detect
  |
  v
Promote Region B
  |
  v
Route traffic
  |
  v
Validate

Questions to answer#

  1. What is the maximum replication lag allowed?
  2. What happens if Region A fails before replication catches up?
  3. How do you avoid duplicate orders?
  4. How do you restore corrupted data?
  5. How do you recover object storage?
  6. How do you recover queues?
  7. How do you recover secrets?
  8. How do you validate business correctness?
  9. How do you test the DR plan?
  10. How do you fail back to Region A?

60. Production DR Checklist#

Business#

  • Critical systems identified
  • Business impact analyzed
  • RPO defined
  • RTO defined

Data#

  • Backups configured
  • Backup retention defined
  • Cross-region copy configured
  • Point-in-time recovery available where required
  • Immutable backups considered
  • Restore process documented

Infrastructure#

  • Recovery environment defined
  • Infrastructure reproducible
  • Capacity sufficient
  • Networking recoverable
  • DNS/global routing configured

Application#

  • Application artifacts available
  • Configuration recoverable
  • Secrets recoverable
  • Dependencies documented

Operations#

  • Runbook exists
  • Ownership defined
  • Incident communication process defined
  • Escalation process defined

Testing#

  • Restore tests performed
  • Failover tested
  • Recovery timing measured
  • Business workflows validated
  • DR exercises scheduled

61. Key Mental Models#

Remember these principles.

1. Replication is not backup#

Replication -> availability
Backup      -> recovery

2. RPO is about data#

How much can we lose?

3. RTO is about time#

How quickly must we recover?

4. Recovery must include dependencies#

Application alone != recovered system

5. Backups must be restorable#

Backup without restore testing = assumption

6. Data correctness matters#

System UP + wrong data = disaster

7. DR is a process, not a server#

Architecture
+
Data
+
Automation
+
Runbooks
+
People
+
Testing

62. Summary#

In this chapter we learned:

  • what Disaster Recovery means
  • why HA does not eliminate the need for DR
  • disaster categories
  • business impact analysis
  • RPO
  • RTO
  • full backups
  • incremental backups
  • differential backups
  • snapshots
  • point-in-time recovery
  • replication vs backup
  • backup retention
  • immutable backups
  • backup encryption
  • 3-2-1 backup principle
  • restore testing
  • recovery drills
  • cold standby
  • warm standby
  • hot standby
  • active-passive DR
  • active-active DR
  • cross-region replication
  • synchronous vs asynchronous replication
  • global traffic failover
  • DNS failover
  • DR runbooks
  • dependency mapping
  • recovery ordering
  • business continuity
  • recovery validation
  • DR testing
  • DR metrics
  • infrastructure as code for recovery
  • DR for secrets, queues, object storage, and Kubernetes
  • production DR checklists
  • DR interview questions
  • DR architecture exercise

The central idea is:

Disaster Recovery is the ability to restore a correct and usable system after a major failure, within the business's required RPO and RTO.


63. Exercises#

Exercise 1#

Explain the difference between:

HA
Fault Tolerance
Backup
DR
Business Continuity

Exercise 2#

A company says:

RPO = 1 hour
RTO = 4 hours

Explain exactly what those requirements mean.


Exercise 3#

Design a DR architecture for a URL shortener.

Consider:

  • database
  • cache
  • object storage
  • DNS
  • backups
  • failover

Exercise 4#

A database replica contains corrupted data because an application bug replicated bad writes.

How would you recover?


Exercise 5#

Design a DR strategy for a payment service with:

RPO = 0 or near zero
RTO = 5 minutes

Explain the trade-offs.


64. Final Takeaway#

A mature production system does not ask only:

"What happens when a server crashes?"

It also asks:

"What happens when the failure is bigger than our redundancy?"

That leads to the complete recovery model:

Failure
   |
   v
Detection
   |
   v
Decision
   |
   v
Failover / Restore
   |
   v
Data Recovery
   |
   v
Service Recovery
   |
   v
Validation
   |
   v
Stabilization
   |
   v
Reconciliation
   |
   v
Post-Incident Improvement

That is the core of Disaster Recovery.


Next Chapter#

Chapter 30 — System Design Security Fundamentals#

The next chapter moves from resilience to security architecture.

We will cover:

  • security fundamentals in system design
  • authentication vs authorization
  • identity and access management
  • sessions and tokens
  • JWT
  • OAuth 2.0
  • OpenID Connect
  • API security
  • encryption
  • TLS
  • secrets management
  • least privilege
  • network security
  • security boundaries
  • common attacks
  • threat modeling
  • secure architecture principles
  • security interview questions

Finished this chapter?

Mark it as complete to track your mastery.

Previous ChapterChapter 28 — Fault ToleranceNext ChapterChapter 30 — System Design Security Fundamentals
PrevNext