SkillSprout
Chapter 23 · Lesson 2
Advanced
4 min read

Failover Strategies and Disaster Recovery (RTO and RPO)

Overview

Once you have a spare, you must decide how ready it is and how traffic moves to it. More readiness means faster recovery and a bigger bill.

You will also learn disaster recovery, with its two key numbers: RTO and RPO.

Detailed Notes

What is failover and disaster recovery

Failover is switching work from a failed component to a spare. Disaster recovery (DR) is the plan for restoring service after a major event, such as a data-centre fire, a regional outage or a destructive mistake.

The problem it solves

Having a spare is not enough. How fast it takes over, how fresh its data is, and how much it costs are all trade-offs. You need a simple way to describe what the business wants, and a menu of designs to match.

How it works

Two failover layouts

  • Active-passive: one copy serves traffic, the other waits as a standby. Simple, but the standby sits idle (wasted money) and takes a moment to take over.
  • Active-active: all copies serve traffic at the same time. No idle spare and instant takeover, but harder to build, because the copies must stay in sync (this is where the CAP trade-offs from earlier apply).

How ready is the standby?

StandbyStateRecovery timeCost
HotRunning, data kept in syncSeconds to minutesHigh
WarmRunning at reduced sizeMinutesMedium
ColdNot running; built from backups when neededHoursLow

How wide is the spread?

  • Multi-zone (several separate data centres in one region): protects against a data-centre failure, with fast, cheap links between them.
  • Multi-region (copies in far-apart regions): protects against a whole region going down, but latency between them is higher and data replication is harder.

A danger: split brain. If a standby wrongly decides the primary is dead (say, only the network between them broke) and both act as the leader, they accept conflicting writes. This is prevented with quorum or leader election (previous chapters).

RTO and RPO: the two recovery goals

  • RTO (recovery time objective): the maximum acceptable downtime. "RTO of 1 hour" means service must be back within an hour.
  • RPO (recovery point objective): the maximum acceptable data loss measured in time. "RPO of 5 minutes" means you can lose at most the last 5 minutes of data, so you need copies at most 5 minutes old.
text
last good copy         disaster           service restored
     |<------- RPO ------->|<---------- RTO ---------->|

Four common DR strategies, from cheapest to fastest:

  1. Backup and restore: keep backups, rebuild when needed. Hours of recovery, lowest cost.
  2. Pilot light: keep only the core (such as the database, replicating) running; start the rest on demand.
  3. Warm standby: a smaller but fully working copy always runs; scale it up when needed.
  4. Multi-site active-active: full copies in several regions serve users all the time. Near-zero RTO and RPO, highest cost.

A simple example

A shop's server room floods. How quickly must the shop reopen (RTO)? If every hour costs 50,000 dollars, three days is a disaster. How many recent orders can it lose (RPO)? If the last backup was 24 hours ago, a whole day of orders disappears. The business sets targets, such as "RTO 1 hour, RPO 5 minutes for orders" but "RTO 24 hours, RPO 24 hours for the internal wiki". Different systems, different prices.

System design example

An e-commerce site picks different designs per part:

  • Checkout and orders: database replicated continuously to a second region, warm standby servers. RTO about 15 minutes, RPO about 1 minute.
  • Product search: can be rebuilt from the main data, so cold standby is fine.
  • Internal reports: nightly backups only.

Test failover regularly. An untested DR plan often fails when it is needed, so teams run "game days" where they deliberately fail over.

Summary

  • Active-passive is simpler; active-active is faster but harder to keep consistent.
  • Hot, warm and cold standbys trade cost against recovery speed.
  • RTO = how long you can be down; RPO = how much data you can lose.
  • Match the strategy to each feature's real needs, and test it.

Architecture Diagram

Active-active across two regions
Architecture
Users
DNSroutes to healthy region
Region 1serving
Region 2serving

Both regions serve users, and each can absorb the other's traffic.

  1. 1DNS sends users to the nearest healthy region.
  2. 2Both regions replicate data to each other.
  3. 3If one region fails, DNS sends everyone to the other.

Common Interview Questions

Chapter quiz

Fault Tolerance vs High Availability · 5 questions

  1. 1.Which statement best describes fault tolerance?

  2. 2.Why is high availability usually chosen over fault tolerance?

  3. 3.Which standby recovers fastest but costs the most?

  4. 4.An RPO of 5 minutes means:

  5. 5.What is split brain?

0 of 5 answered

Finished this lesson?

0 of 91 lessons done · 0% of the course