Stage 6 · Architecture at scale · Hard · 20 min
Multi-region architecture and disaster recovery
Survive the loss of a whole region. Set an RPO and an RTO, pick a standby from backups to active-active, and see how failover works and what it costs.
What each interview level is expected to know
Learn first: Replication and sharding, CAP, PACELC and quorums, Observability, SLOs and error budgets
After this lesson you can:
- Set an RPO and an RTO for each kind of data.
- Compare backups, a standby and active-active by cost and recovery time.
- Plan a failover that fences the old region and does not overload the new one.
Start here
See it in 60 seconds
When a whole region fails
When the main region fails, the copy elsewhere takes over; how far behind it was decides the writes lost, and detection decides the time down.
Scene 1 of 6 · One region serves
All writes go to US East, and EU West keeps a copy, ready to take over.
- Users — healthy
- US East — healthy — primary
- EU West — healthy — standby
- Confirmed writes lost
- not shown yet
- RTO, in seconds
- not shown yet
- One region serves. All writes go to US East, and EU West keeps a copy, ready to take over.
- Copies arrive later. In the lab's sped-up settings, copying is asynchronous and EU West runs about 500 ms behind.
- US East fails. Then US East goes down, taking with it every write that had not been copied yet.
- Writes lost: the RPO. Say 1,000 writes arrive a second: being 500 ms behind loses about 500 of them.
- Time down: the RTO. Health checks notice after 3 s, and cached DNS answers expire 5 s later: about 8 s down.
- Pay to shrink them. Real failovers often take minutes; here the warm standby needs 8 s more: 16 s in all.
- Now you try. How far behind US East is the copy in EU West when it fails? For example: 1,000 ms behind, at 1,000 writes a second, loses about 1,000 confirmed writes when US East fails. Those users were told their writes were saved, so data like payments often needs synchronous copies.
Scene 1 of 6: One region serves. All writes go to US East, and EU West keeps a copy, ready to take over.
Key points
- The RPO is how much recent data a failure may lose; replication lag sets it.
- The RTO is how long users are down: noticing the failure, moving traffic, and scaling up.
- Synchronous copies lose nothing but make every write wait for the far region.
- A standby that is already fully running takes over faster, but costs more every day.
In plain words
Say all writes go to a region called US East, and a second region, EU West, keeps a copy that runs 500 ms behind. US East fails while 1,000 writes arrive each second. The last 500 writes were confirmed to users but not yet copied, so they are lost. Health checks notice the failure after 3 seconds. Users' devices keep the old address for 5 more seconds, so users are down for about 8 seconds. Two targets describe a plan like this. The (How much recent data a failure may lose, measured in time.) (RPO) is the amount of recent data you accept losing, measured in time. The (How long a system may be down after a failure.) (RTO) is how long the system may be down. This setup meets an RPO of half a second and an RTO of 8 seconds. Those times come from a sped-up lab, and a real (Switching to a backup, such as promoting a replica to primary, after the original one fails.) often takes minutes.
Plans differ in how ready the second region is. The cheapest keeps backups there and rebuilds after a failure, which can take hours. A dearer plan keeps the second region running, standing by or serving users all the time, so it takes over in minutes or less. Copying each write to the second region before confirming it means no confirmed write is lost, but every write then waits for that trip.
The problem it solves
Regions do fail: a power cut, a network fault, a bad deploy or a problem at the cloud provider. With one region, the service is down until that region recovers. Data that was not copied anywhere else can be lost for good. A copy in a second region fixes that, and raises two new questions. How far behind is the copy? And how do you move users to it without breaking more?
Why it matters
A cloud region is a group of data centres in one area, such as US East. A whole region can fail, and then every server in it is out of reach. A system that runs in one region stays down until that region comes back. Planning for this means choosing how much data you may lose and how long you may be down. Each step toward less loss and less downtime costs more, so the choice belongs to the business as much as to the engineers.
A worked example
Say US East takes 1,000 writes a second, and its copy in EU West runs 500 ms behind. If US East fails, about 1,000 × 0.5 = 500 confirmed writes are lost: an RPO of half a second. Health checks notice after 3 seconds, and cached (The Domain Name System: the way the internet turns a name, such as example.com, into the address of a server.) answers last 5 more, so users are down for 3 + 5 = 8 seconds. The warm standby then needs 8 more seconds to reach full size: 16 seconds in all. These are the lab's sped-up times, and a real failover often takes minutes.
Think of it like…
Think of a photo album at home, with copies of your pictures sent to a cousin across town now and then. If the album is destroyed, the pictures not yet copied are gone. You have none at all until you fetch the cousin's copy.
Where this analogy stops working
What you lose and how long you wait are the two useful parts: RPO and RTO. But you know when your album is gone. A system has to decide that a region is down, and a slow region looks much the same. Switch too early, and both regions take writes.
Try it
See it working
Also try: Replication · CAP & consistency
Mechanics
How it works
Set an RPO and an RTO for each kind of data
Ask what each kind of data is worth. A payment may need an RPO near zero, because a lost payment costs money and trust. A page-view count for a weekly report can lose an hour and nobody is hurt. So one system can hold several plans: a strict one for payments and a cheap one for reports.
Choose how much to keep running
Backup and restore keeps only backups in the second region, and rebuilds the system there after a failure. (A cheap standby that keeps data replicated but runs only a small fleet, and must scale up before it can take full traffic.) keeps the data copied all the time, with few or no servers running. A warm standby runs a smaller copy of the whole system, such as half the servers. A hot standby runs a full-size copy. Each plan recovers faster than the one before it, and costs more every day.
Choose who serves: one region or both
In (A setup where one region takes all the writes and a second region stands by, ready to take over if the first one fails.), one region takes all the writes and the other waits as a standby. In (A setup where every region takes traffic and accepts writes at the same time, instead of one region standing by.), both regions serve nearby users and copy their writes to each other. When one fails, its users move to the other, which is already serving. The price is conflicts: two regions can change the same record at the same moment.
Replicate across regions
Pick a case to follow belowWith this case: The payment was confirmed at 5 ms but never reached EU-West, so the failover lost it.
Users, in the US Users in the US DNS, TTL 5 s DNS TTL 5 s US-East, primary, NOW US-East primary p-91 saved NOW EU-West, standby EU-West standby Witness, third site Witness third site - Users — in the US — healthy
- DNS — TTL 5 s — healthy
- US-East — primary — healthy — NOW — p-91 saved
- EU-West — standby — healthy
- Witness — third site — healthy
- Write
- Copied write
Step 1 of 3Step 1 of 3 · US-East
Done: US-East saves the payment and confirms it
- What happens
- The primary writes p-91 and tells the user it is saved at 5 ms.
- Why
- With async copying, the primary does not wait for the other region.
- What changes
- The copy to EU-West leaves now and takes 40 ms.
- Next
- US-East fails at 30 ms
User told "saved"at 5 msIn EU-Westnot yetWatch: confirmed, not copiedStep 1 of 3: US-East. US-East saves the payment and confirms it. The primary writes p-91 and tells the user it is saved at 5 ms.
With (Replying right away, without waiting for another step to finish. That step is done later, by itself.) (Continuously copying every write from a primary database to one or more replicas, so each one ends up with the same data.), the primary confirms a write first and copies it afterwards. Writes stay fast, but a failure loses whatever was not yet copied. With (Waiting for another step to finish before confirming, instead of moving on right away.) replication, a write is confirmed only after the second region has it too. A confirmed write then survives the loss of one region, but every write waits for the trip between regions. If the far region cannot be reached, the write cannot be confirmed at all.
In the picture, a trip between the regions takes 40 ms. With async copying, payment p-91 is confirmed at 5 ms, and US-East fails at 30 ms, before the copy lands. EU-West takes over without it. With sync copying, the payment is confirmed at 85 ms, after EU-West has it, so the failover loses nothing.
Detect, fence and fail over
Pick a case to follow belowWith this case: US-East was fenced before EU-West took over, so only one region took writes. Users moved about 20 seconds after the link broke.
Users, in the US Users in the US DNS, TTL 5 s DNS TTL 5 s US-East, primary US-East primary cut off EU-West, standby EU-West standby Witness, third site, NOW Witness third site US-East: down? NOW - Users — in the US — healthy
- DNS — TTL 5 s — healthy
- US-East — primary — healthy — cut off
- EU-West — standby — healthy
- Witness — third site — healthy — NOW — US-East: down?
- Health check
- Instruction
Step 1 of 4Step 1 of 4 · Witness
Watch: The witness marks US-East down after 15 s
- What happens
- Checks every 5 seconds get no answer 3 times in a row.
- Why
- One missed check could be a blip, so several are needed.
- What changes
- But US-East is still running, and users near it can still reach it.
- Next
- US-East stops taking writes
Time since the link broke15 sRegions taking writesUS-EastStep 1 of 4: Witness. The witness marks US-East down after 15 s. Checks every 5 seconds get no answer 3 times in a row.
What these pictures simplify. These pictures use stated times: 40 ms one way between regions, checks every 5 seconds and a 5-second TTL. Real trips depend on the distance, and some devices keep a DNS answer longer than its TTL.
Health checks call each region every few seconds, and mark one that stops answering as down. Before the standby is promoted to primary, the old primary must be stopped from taking writes. This is called fencing. A third site, called a (A third site that must agree a primary is truly down before another region takes over. This stops a network partition alone from causing a failover.), gives a third vote: only a side that can reach two of the three sites may take writes. Then DNS or a global (A server that receives every request first and passes each one to one of several servers behind it.) sends users to the new primary. Devices keep the old DNS answer until its (How long a cached copy is kept before it is thrown away.) (time to live) ends.
In the picture, the link to US-East breaks, but US-East still runs. Checks every 5 seconds miss 3 times, so it is marked down after 15 seconds. With fencing, US-East cannot renew its lease with the witness, so it stops taking writes before EU-West is promoted. A 5-second TTL then moves users about 20 seconds after the link broke.
With no fencing, both regions take writes at once. Two users can change the same account in two places, and one change must later be merged or thrown away.
Warm up and rehearse
A standby is smaller than the primary, and its caches are empty. Scale it up before it takes all the traffic: the warm standby in the lab above needs 8 more seconds. Practise the whole failover on a schedule. A plan that has not been run often fails in a way nobody planned for.
Use it when
- Downtime or lost data costs more than a second region: a payment system or a large shop loses money each minute it is down.
- Users live on several continents: active-active serves each user from a region near them, so pages load faster.
- A contract or a regulator asks for it: some require a tested recovery site far from the main one.
Skip it when
- An early or internal service: backups plus several (One of several separate data centres inside one cloud region, each with its own power and network.), the separate data centres inside one region, often meet the RTO.
- Active-active for data that two regions often change at once, such as a stock count: every conflict needs a rule you have designed.
- A team with no time to rehearse failover: an untested standby costs money every day and may not work when needed.
Check yourself
Judgement
Trade-offs and how it fails
What you give up
- Cost
- A second region that can take all the traffic needs about as many servers as the first, so the server bill about doubles. A warm standby at half size costs less each day. It pays for that with time to scale up after a failure.
- Consistency
- Asynchronous copying keeps writes fast, but the standby is behind, so a failure loses recent writes. Synchronous copying keeps every confirmed write, and each write waits for the far region. Active-active also needs a rule for conflicts, such as (A conflict rule that keeps whichever write has the newer timestamp and discards the other one.), which drops one of two clashing writes.
- Speed
- Automatic failover is fast, but a false alarm can start a move that nobody needed. A person deciding is slower and avoids that. A middle path is to automate every step and let a person decide when to start.
Failure modes
- The standby is overloaded: it gets all the traffic with half the servers and empty caches, and fails too. Scale it up and warm it before the full move.
- (Two servers or regions each believe they are the leader, and both accept writes at once. It usually happens during a network partition.): a network fault cuts the regions apart, and both act as primary and accept writes. Fence the old primary, or use a witness, before you promote.
- Confirmed writes are lost: the old primary held writes that had not reached the standby. When it returns, they must be thrown away or merged by hand.
- Failover on a false alarm: a short network fault makes a healthy region look dead. The move itself then causes the outage.
- Users stuck on the dead region: their devices keep the old DNS answer until the TTL ends, and some software keeps it longer.
- A shared part outside both regions: both depend on one sign-in service or one settings store. When it fails, both regions fail together.
In the real world
- Netflix has described an exercise it calls Chaos Kong. It simulates the loss of a whole AWS region and moves the traffic to the other regions.
- GitHub's report on its October 2018 incident says the link to its main data centre was down for 43 seconds. Its failover tool promoted databases in another data centre. Some writes had not been copied, and service was degraded for 24 hours and 11 minutes. Source: GitHub blog: October 21 post-incident analysis (2018) (checked 14 October 2026)
- The AWS guide to reliability lists four recovery plans. From cheapest to fastest: backup and restore, pilot light, warm standby, and active-active across sites.
- Google's Spanner paper (2012) describes a database that confirms a write only after most of its copies have it. The copies can sit in different regions. Source: Google: the Spanner paper (2012) (checked 14 October 2026)
Trade-offs to be ready to discuss: Active active vs active passive
Check yourself
Interview
What interviewers look for
- Ask for the two numbers before you draw anything: "How much data can we lose, and how long can we be down?"
- State the cost with the choice: "A warm standby at half size meets a 15-minute RTO. Active-active would double the servers for little gain here."
- Say what is lost: "Replication is asynchronous with about 500 ms of lag, so a failover can lose the last half second of writes."
- Name two failover risks with their fixes: fence the old primary against split brain, and scale up the standby before it takes all the traffic.
Say it out loud: With asynchronous replication between regions, what RPO can you meet?
Expected depth by interview level
Levels describe the depth interviewers probe, not years of experience. Choose a level on the learning path to highlight it.
- JuniorBeyond this level
- Not usually expected.
- MidUseful
- Backups, and more than one data centre in a region.
- SeniorCore
- RPO and RTO, active-passive failover, replication lag.
- StaffCore
- Active-active vs standby as a cost and consistency decision.
Practice
Apply it
Three harder questions
The first two use the idea on a new case. The last asks you to judge a design.
Apply it
Apply it
Judge a design
Go deeper
Sources and further reading
First-hand sources to check this page against and to go further. They are standards, official docs, original papers, and guides from engineering and security teams. Each link was opened on 8 November 2026.
- Engineering guideDisaster recovery options in the cloudAWS whitepaperBackup and restore, pilot light, warm standby and active-active, by recovery time and cost.
- Engineering guideData Integrity: What You Read Is What You WroteGoogle SRE bookWhy a backup only counts once a restore from it has been tested.