Video in progress

What would your recovery plan be if an entire region failed? How do you set RPO and RTO?

RPO is how much data we're willing to lose, RTO is how fast we recover. I agree on them with the business per system, then match the replication type, the backups and the failover automation to those numbers, and I check the plan with regular real drills.

📖 Answer

Demanding "zero loss, zero downtime" from every system is far too expensive. So I split systems into tiers:

Tier Example RPO RTO
1 payments, ledger ~0 < 15 minutes
2 orders, catalog < 1 minute < 1 hour
3 analytics, reports < 24 hours < 1 day

Technical decisions follow from the numbers:

  • RPO ≈ 0: synchronous replication to another region (cross-region latency is added to every write), or at least synchronous to two nearby zones and asynchronous to a far one. With asynchronous replication you can't promise "zero loss": data within the lag is lost.
  • RTO of minutes: a warm environment in another region, with the applications running or quick to start, the DB replica ready, and DNS/global load balancer switching automatically or with one button.
  • RTO of hours: infrastructure written as code, backups in another region, brought up from scratch when needed. Cheap, but slow.

Things that are often forgotten:

  • Has the backup restore been tested? A backup you haven't restored is not a backup. An automatic weekly restore test.
  • Logical errors. Replication copies DELETE FROM users instantly too. Point-in-time recovery and a delayed replica protect against that.
  • Dependencies. The DB moved, but secrets, DNS, or a third party's whitelist only has the old region's IPs.
  • Failback. After the primary region recovers, how do we go back, and what happens to the writes that differ by then?

And most important is the drill. A planned region failover at least twice a year. The first drill always turns up something that isn't in the documentation; you'd rather find it in a drill than during an incident.