Disaster recovery explained: RPO vs RTO, backups and multi-region DR strategies

Resilience patterns handle a slow service. Disaster recovery handles losing a whole data centre, a corrupted database or a deleted table. Learn RPO and RTO, the kinds of backup, why backups and replication are not the same thing, and the four DR strategies from backup-and-restore to active-active.

A car with its boot open. The spare tyre has been taken out, and a person stands beside it, checking it with a pressure gauge. A banner at the top says 'A spare you've never checked is not a spare.' A note by the tyre reads 'backup, tested monthly'.
Fig. 1 — A backup is like a spare tyre: you hope you never need it, and it's useless if you only find out it's flat on the day you do.

The patterns in the last article, like timeouts, circuit breakers and retries, deal with small failures: a slow service, a dropped connection, a server that restarts.

Disaster recovery (DR) is for the big ones:

  • a whole data centre or cloud region goes offline (power, fire, flood, a provider outage)
  • a bad deploy or a bug corrupts the database
  • someone deletes data by mistake
  • an attacker encrypts your data (ransomware) or deletes your servers

These aren’t made-up worries. In 2017, an engineer at GitLab accidentally deleted a production database folder. When the team went to restore it, they found their backups had been failing quietly for a long time. The site was down for about 18 hours and around 6 hours of user data was lost. In 2014, a company called Code Spaces had an attacker get into its cloud account and delete servers and backups, because both lived in the same account. The company shut down.

“Good code and good resilience patterns can’t save you from a disaster you never planned for.”

This is the last article in the Reliability & fault tolerance thread.

RPO and RTO: the two numbers that decide everything

Every DR plan starts with two questions for the business, not for engineers.

RPO (recovery point objective): how much data can we afford to lose? If you back up every hour, a disaster just before the next backup loses up to an hour of data. So your RPO is 1 hour.

RTO (recovery time objective): how long can we afford to be down? If the business says the site must be back within 15 minutes, your RTO is 15 minutes.

A timeline. On the left, a green marker for the last good backup at 10:00. In the middle, a red lightning bolt for the disaster at 10:45. On the right, a green marker for 'back online' at 11:15. The gap from the backup to the disaster is labelled RPO, data lost: 45 minutes, looking back. The gap from the disaster to being back online is labelled RTO, downtime: 30 minutes, looking forward.
RPO looks back: how much data is gone. RTO looks forward: how long until you're back.

A simple way to remember: RPO is about data, RTO is about time. RPO looks back from the disaster; RTO looks forward.

Different data deserves different numbers:

System RPO (data loss allowed) RTO (downtime allowed)
Payments and bank transactions Zero, or seconds Minutes
Online shop orders A few minutes 15–30 minutes
User profile changes About an hour A few hours
Analytics and reports A day A day

Lower numbers always cost more. Getting RPO close to zero means copying every write to another place as it happens. Getting RTO close to zero means a second copy of your whole system already running. So the right answer isn’t “as low as possible”. It’s “as low as this data is worth”. A shop that makes ₹10 lakh an hour can justify spending a lot to cut downtime; an internal dashboard can’t.

Backups: your time machine

A backup is a copy of your data, saved somewhere else, that you can go back to. There are three common kinds:

Kind What it saves Good Not so good
Full Everything, every time Simplest to restore Slow and takes a lot of space, so you can’t do it often
Incremental Only what changed since the last backup Fast and small, so you can do it often A restore needs the last full backup plus every incremental after it
Continuous (point-in-time recovery) The database’s change log, streamed all the time Restore to any second, e.g. “10:42:15, just before the bad deploy” Needs database support and more storage

A common setup: a weekly full backup, daily or hourly incrementals, and point-in-time recovery for anything important. Managed databases such as Amazon RDS and Cloud SQL offer point-in-time recovery with a setting.

Where you keep backups matters as much as making them. A good rule of thumb is 3-2-1:

  • 3 copies of the data,
  • on 2 different kinds of storage,
  • with 1 copy somewhere else: another region, and ideally another account, so one stolen password can’t delete everything.

For ransomware, also make at least one copy immutable: once written, nobody can change or delete it for a set time (for example, S3 Object Lock).

Backups are not replication

People often say “we have a replica, so we’re safe”. That’s only half true. A replica and a backup protect you from different things.

Two panels. Left, replication: the primary database copies every change to a replica within seconds. When the primary's region goes down, the replica takes over with only a few seconds of data lost. But when someone runs 'DELETE FROM orders' by mistake, the replica copies the delete too, and the data is gone in both places. Right, backups: copies from 02:00, 03:00 and 04:00 sit in a separate store. They are slower to restore, but after a bad delete at 04:30 you can go back to 04:00, or to the second before the delete with point-in-time recovery.
A replica copies everything, including your mistakes. A backup lets you go back in time. You need both.
  • Replication copies every change to another server within seconds. It’s great when a server or region dies: switch to the replica and you lose only a few seconds of data.
  • But replication also copies mistakes. If someone runs DELETE FROM orders without a WHERE, the replica deletes the orders too, a second later.
  • Backups let you go back in time to before the mistake. They’re slower to restore, but they’re the only thing that saves you from corruption, bad deploys and deletes.

So the rule is simple: replication for outages, backups for mistakes. Most real systems need both.

The four DR strategies

When a whole region fails, how do you get running somewhere else? There are four standard strategies, and they trade cost against speed of recovery:

Four steps rising from left to right, each higher step costing more and recovering faster. Step 1, backup and restore: only backups are kept in the second region; rebuild everything after a disaster; RTO hours, RPO hours; cheapest. Step 2, pilot light: the database is replicated to the second region, but app servers are off; turn them on when needed; RTO tens of minutes, RPO minutes. Step 3, warm standby: a small copy of the whole system runs in the second region; scale it up on failover; RTO minutes, RPO seconds to minutes. Step 4, active-active: both regions serve real traffic all the time; RTO near zero, RPO seconds; most expensive and most complex.
Each step up costs more and recovers faster. Pick the lowest step that meets your RPO and RTO.
Strategy What’s ready in the second region RTO RPO Cost
Backup and restore Only the backups Hours Hours Lowest
Pilot light Database replica; app servers off Tens of minutes Minutes Low
Warm standby A small, working copy of everything Minutes Seconds to minutes Medium
Active-active A full copy, serving real users Near zero Seconds Highest (about double)

A few notes in plain words:

  • Pilot light is named after the small flame in a gas heater: the important part (the data) is always on, and you turn up the rest when needed.
  • Warm standby usually means: shift traffic with DNS, promote the database replica to primary, and scale the small app fleet up to full size.
  • Active-active sounds ideal, but two regions both accepting writes means the same record can change in both places at once. You need a plan for those conflicts, which is hard. Many teams run active-active for reads and keep one region in charge of writes.
  • Even with replication, RPO is rarely truly zero. Copies to another region are usually sent after the write is confirmed, so the last few seconds can be lost. True zero means waiting for the far region on every write, which makes every write slower.

For most products, warm standby is the sensible middle. Pick the cheapest step that still meets the RPO and RTO you agreed with the business.

Test it, or it isn’t a plan

GitLab had backups; they just didn’t work. A DR plan you’ve never run is a guess. To make it real:

  • Restore a backup on a schedule, say monthly, into a test environment, and check the data is all there. Time it: that’s your real RTO.
  • Alert when a backup is missing, not just when one fails. “No successful backup in 26 hours” is the alert that would have saved GitLab.
  • Practise a region failover a few times a year. Netflix regularly moves traffic out of a whole AWS region on purpose to prove it can.
  • Write a runbook: the exact steps, who does them, and who decides to fail over. At 3 a.m. during a real disaster, nobody should be making it up.

What breaks, and how to fix it

What breaks What you see The fix
Backups fail silently On the day you need one, there isn’t a good one Alert on missing backups, and restore one every month
A hidden shared dependency You’re “multi-region”, but login, files or logs all live in one region, so a single outage takes down every region Give each region its own copy of every critical service. Ask “what if this region vanished?” for each one
Backups in the same account An attacker or a bad script deletes servers and backups together Keep a copy in a separate account, and make it immutable
A mistake copied to the replica A bad delete or corrupt data appears everywhere within seconds Point-in-time backups to go back to before the mistake
Nobody knows the steps A slow, panicked recovery that takes far longer than the RTO A written runbook, and practice drills

Puzzle 1: the backup that didn’t help

Region outage: you fail over to the replica. You lose about 5 seconds of data, well inside your 5-minute target. The nightly backup would have lost 8 hours, so it’s not what saves you here.

Bad deploy: the replica copied the corruption within 5 seconds, so it’s no help. Your only clean copy is the 2 a.m. backup, which means losing 8 hours of orders. That misses your target badly.

The fix: replication covers outages, but for mistakes you need point-in-time recovery, so you can restore to 9:59 a.m., just before the deploy. Then both cases meet the 5-minute target.

Puzzle 2: multi-region, but read-only

The fallback only covered reads. Region B’s database is a read-only replica. Every write still goes to region A, which is down, so the app has quietly become read-only.

The fix: a real failover must also move writes. That means promoting region B’s replica to be the new primary, pointing the app’s writes at it, and making sure region A can’t come back and accept writes too (the split-brain problem from designing for failure). Multi-region reads are easy; multi-region writes need a planned, practised switch-over.

Key takeaways

  1. Disaster recovery is for big failures: lost regions, corruption, deletes and attacks.
  2. RPO is how much data you can lose; RTO is how long you can be down. Agree both with the business, per system.
  3. Use full, incremental and point-in-time backups, kept 3-2-1, with one copy in a separate account and immutable.
  4. Replication is for outages; backups are for mistakes. You need both.
  5. Pick a DR strategy from backup-and-restore, pilot light, warm standby or active-active: the cheapest one that meets your RPO and RTO.
  6. Test restores and failovers regularly. An untested backup is a spare tyre you’ve never checked.

That completes the Reliability & fault tolerance thread: designing for failure, resilience patterns, and now disaster recovery. Next in the series, we move on to observability: how to see what your system is doing, so you notice failures before your users do.

Comments

LEAVE A COMMENT
No sign-up. Comments appear after a quick review.