Multi-region design
Running a system in several regions: disaster recovery strategies with their RPO and RTO, replication choices and what each costs in latency and lost writes, quorum latency across regions, routing, failover headroom, and data residency.
ConceptApplied23 min readUpdated
- 3 code samples
- 6 interviewer follow-ups
- 5 self-checks
On this page12 sectionsHLDLLDSenior depth
Read first: Replication and sharding, Consistency and availability, DNS, CDNs and the edge
- State a recovery objective as an RPO and an RTO, and pick the disaster-recovery strategy that meets it at the lowest cost.
- Compare asynchronous, quorum, multi-leader and home-region replication by write latency, lost writes and conflicts.
- Compute the commit latency of a quorum across regions, and place a leader near the writers.
- Size capacity so the survivors can carry a lost region's load, and avoid the traps of failover.
- Place data by residency, and limit the blast radius with cells and staged rollouts.
3 code samples (71 lines), collapsed so the explanation stays in focus.
Running in more than one region is the biggest step in a system's life after scaling out, and the easiest to get wrong, because it is not "run it twice". Every piece of state has to say where its source of truth is, how far behind a copy may be, and what happens to the writes in flight when a region disappears. Interviewers use the topic to find out whether you reason from a requirement (a number for lost data and a number for downtime) or from a diagram with two boxes labelled "US" and "EU". This lesson starts with the requirement, then the strategies, the data, the routing, the capacity trap and the legal limits. The numbers come from small simulations.
There are four honest reasons. Availability: a region is a failure domain, not only for power and network but for its control plane, its shared services and the configuration pushed to it. Latency: light in fiber covers about 100 km each way per millisecond, so a user on another continent pays 100 to 250 ms for every round trip to a distant region, which a CDN removes for cacheable content and nothing removes for writes. Residency: the law may require that some data stays in a country or bloc. Capacity: a region has quotas and limits.
The costs are at least double the infrastructure, replication traffic, a harder operational life and consistency compromises. An availability zone (AZ) is a separate building with independent power and network inside a region, one to two milliseconds from its neighbours, and a design that spans three AZs already survives most hardware and building failures at no latency cost. What it does not survive is a failure of something the whole region shares, or a bad deploy that reaches every AZ at once. So the honest advice is to start single-region and multi-AZ, and add a region when a stated requirement (an RTO or RPO that multi-AZ cannot give, users far from the region, residency) demands it. And remember that a second region does not protect against a bad change that you push to both.
RPO (recovery point objective) is how much data you can afford to lose, measured in time: "the last five seconds of writes". RTO (recovery time objective) is how long you can be down. They are business numbers, and "99.99%" is not one of them. Each tighter number costs money, so the right design is the cheapest one that meets both.
| Strategy | What runs in the second region | Typical RPO | Typical RTO | Cost |
|---|---|---|---|---|
| Backup and restore | Nothing: backups are copied there | Hours: the backup interval | Hours to a day: rebuild everything | Lowest |
| Pilot light | The data layer, replicated and running. Compute is off, with images ready | Minutes: the replication lag | Tens of minutes: start and scale the compute | Low |
| Warm standby | A scaled-down but running copy of the whole stack | Seconds to minutes | Minutes: scale up and switch traffic | Medium |
| Active-active | Full capacity in two or more regions, all serving traffic | Near zero to seconds | Seconds to a few minutes | Highest |
The ranges are typical and depend on the data layer more than on anything else. An RTO is a sum of steps, and each is worth stating.
detect: 3 failed checks x 10 s = 30 s
decide: automatic 0 s, or a person 5 to 15 min
promote: promote the replica or scale up the compute, 1 to 15 min
move users: DNS TTL 60 s plus stragglers, 1.5 to 5 min
warm up: caches and connection pools, 1 to 10 min
warm standby, automatic: about 10 min. Pilot light, manual: 30 min or moreThe numbers are an illustrative budget, not a benchmark, but the shape is general. The decision step and the warm-up are the ones that surprise people, and the only way to know the real total is to fail over on purpose, regularly. A plan that has never been run has failed, and nobody has noticed yet.
Stateless services are easy to run in several regions. The data decides everything, and there are four patterns.
| Pattern | Writes | Reads | Lost data on failover (RPO) | Price |
|---|---|---|---|---|
| Single leader, asynchronous replicas | In the leader's region, replicated in the background | Local from replicas, possibly stale | The replication lag: the last writes | Cheap and common. Distant writers pay the trip to the leader |
| Single leader, quorum across regions (Spanner and CockroachDB style) | Commit when a majority of regions has the entry | Strong from the leader, bounded-stale locally | Zero | Every write pays the round trip to the nearest majority |
| Multi-leader (active-active) | In any region, replicated asynchronously | Local | Small, but concurrent writes conflict | Conflicts must be resolved: last-write-wins loses updates, merging needs a design |
| Partition by home region | In the home region of the user or tenant, which is the leader for its data | Local for most | Per partition, to a standby region | Cross-region users pay the trip, moving a partition is a migration, a global directory is needed |
Quorum latency. A leader commits when a majority of the replicas has the entry. It counts as one vote, so it waits for the nearest majority minus one followers, and the slowest of those decides: the commit latency is the round trip to that follower. With three regions the leader needs one other, so the nearest. With five it needs two others, so the second nearest. The sample computes it over an illustrative round-trip matrix between five regions (typical of public inter-region measurements, not exact), and then the average write latency for users spread evenly over the regions, for each choice of leader.
C# · Illustrative round-trip times between five regions, in milliseconds.
using System;
using System.Diagnostics;
using System.Linq;
// Illustrative round-trip times between five regions, in milliseconds.
string[] regions = { "us-east", "us-west", "eu-west", "ap-south", "ap-northeast" };
double[,] rtt =
{
// us-e us-w eu-w ap-s ap-ne
{ 0, 65, 70, 190, 150 },
{ 65, 0, 135, 220, 100 },
{ 70, 135, 0, 120, 220 },
{ 190, 220, 120, 0, 130 },
{ 150, 100, 220, 130, 0 },
};
// A leader commits when a majority of the replicas has the entry. The leader counts as one vote, so it waits for the (majority - 1)
// nearest followers, and the slowest of those decides: the commit latency is that follower's round trip.
double CommitLatency(int leader, int[] replicas)
{
int majority = replicas.Length / 2 + 1;
var others = replicas.Where(r => r != leader).Select(r => rtt[leader, r]).OrderBy(x => x).ToArray();
return others[majority - 2];
}
int[] three = { 0, 2, 3 }; // us-east, eu-west, ap-south
int[] five = { 0, 1, 2, 3, 4 };
Debug.Assert(three.Select(l => CommitLatency(l, three)).SequenceEqual(new double[] { 70, 70, 120 }));
Debug.Assert(five.Select(l => CommitLatency(l, five)).SequenceEqual(new double[] { 70, 100, 120, 130, 130 }));
// A write from a user near region u to a leader in region l costs the trip to the leader plus the commit.
double AverageWrite(int leader, int[] replicas) => replicas.Average(u => rtt[u, leader]) + CommitLatency(leader, replicas);
Debug.Assert(five.Select(l => AverageWrite(l, five)).SequenceEqual(new double[] { 165, 204, 229, 262, 250 }));
Debug.Assert(AverageWrite(0, five) < AverageWrite(3, five) - 90); // the best leader is 97 ms better, on average, than the worst| Leader in | Commit latency, 3 regions (us-east, eu-west, ap-south) | Commit latency, 5 regions | Average write latency for users spread evenly, 5 regions |
|---|---|---|---|
| us-east | 70 ms | 70 ms | 165 ms |
| us-west | 100 ms | 204 ms | |
| eu-west | 70 ms | 120 ms | 229 ms |
| ap-south | 120 ms | 130 ms | 262 ms |
| ap-northeast | 130 ms | 250 ms |
Three things to read from it. Latency is physics. A write that must be durable in two distant places pays at least a round trip between them (70 to 130 ms here), and no engineering removes that. The leader's location matters: the best leader gave 165 ms on average and the worst 262, a difference of 97 ms on every write, which is why systems let you pin leaders (or per-partition leaseholders) near the users who write, and move them with the sun. Adding replicas does not always add latency, but adding far ones can: the five-region quorum from us-east cost the same 70 ms as three regions, because its second nearest follower is the same one. These systems are built on the consensus protocols in the consensus lesson, with the wide-area twist that a "round" is now a hundred milliseconds.
Asynchronous replication loses data, and you can compute how much. A leader acknowledges a write and ships it. If its region fails, every acknowledged write that had not yet arrived is gone from the survivor. At a write rate w and a mean lag L the expected loss is about w × L. The sample runs a thousand failures of a leader that acknowledges 1,000 writes a second to a follower with a random lag of mean 200 ms.
C# · Asynchronous replication: a leader acknowledges 1,000 writes a second and ships each to…
using System;
using System.Diagnostics;
using System.Linq;
// Asynchronous replication: a leader acknowledges 1,000 writes a second and ships each to a follower with a random lag (mean 200 ms).
// Its region fails at 5 seconds. Writes that were acknowledged but not yet received are lost.
var lagRandom = new Random(2);
int LostWrites()
{
int lost = 0;
for (int i = 0; i < 5_000; i++) // one write per millisecond, from 0 to 5 seconds
{
double writtenAt = i / 1000.0;
double lag = -0.2 * Math.Log(1 - lagRandom.NextDouble()); // exponential lag with a mean of 200 ms
if (writtenAt + lag > 5.0) lost++;
}
return lost;
}
var losses = Enumerable.Range(0, 1_000).Select(_ => LostWrites()).ToArray();
Debug.Assert(Math.Abs(losses.Average() - 199.3) < 0.2); // about rate times lag: 1,000 x 0.2 s = 200 writes
Debug.Assert(losses.Max() == 244 && losses.Min() > 150); // and never zeroAbout 200 acknowledged writes (199.3 on average, 244 at worst in a thousand failures) never reached the survivor, which is an RPO of about 200 milliseconds. Real lag has a heavy tail, so it can be seconds during a bulk load or a network problem. Synchronous replication to even one follower loses none and adds a round trip to every write, which is the trade: 200 lost writes at the moment of a regional disaster against 70 to 130 ms on every write, all the time. For a payment ledger it is an easy choice, and for a "like" counter it is the other way. The lost writes are not destroyed. They are in the dead leader's log, and a recovery plan decides whether and how to merge them when it returns.
Multi-leader replication writes locally everywhere, which gives the best latency and the hardest correctness. Two regions can change the same record at the same time, and something has to decide. Last-write-wins by timestamp silently discards one of them, and clocks disagree (see the clocks lesson). Merge types (counters, sets and other CRDTs) converge without losing updates but only for operations that commute. The best fix is to avoid conflicts by design: give each record one home region where it is written, which is the last row of the table. A user's data is written in their home region, a global directory says which region that is, requests are routed there, and the other regions hold a replica for reads and for recovery.
- Entry. Latency-based or geographic DNS, or anycast, sends users to the nearest healthy region (see DNS, CDNs and the edge). Health must be judged from several vantage points, with a threshold and hysteresis, or one network glitch moves everyone. Weights allow a gradual shift for a deploy or a drain.
- Home region. For partitioned data the front door looks up the user's home region and serves the request there or redirects it, so most users never leave their region.
- Stateless services. Keep sessions in signed tokens or a replicated store, and make sure signing keys, secrets and configuration exist in every region before the day they are needed.
- No synchronous calls across regions on the request path. They add the round trip to every request and couple the regions: a local failure becomes global. Serve each request from region-local data, and replicate asynchronously.
- Caches and queues are per region. After a failover the receiving region's caches are cold, and its database meets the full miss traffic (the stampede cures from the cache lessons apply). Queues need a plan for the dead region's backlog: mirror them, or make the producers and consumers idempotent so that replay is safe.
The capacity trap. When a region fails its load moves to the others. With N regions each running at utilization u, the survivors run at u × N ÷ (N − 1). Two regions each at 60% leave one region at 120%: the failover turns a regional outage into a total one. To keep the survivors under a ceiling, normal utilization must not exceed ceiling × (N − 1) ÷ N.
C# · Load per surviving region after one of `regionCount` regions fails, if the load is…
using System;
using System.Diagnostics;
// Load per surviving region after one of `regionCount` regions fails, if the load is shared evenly.
double AfterFailure(double utilization, int regionCount) => utilization * regionCount / (regionCount - 1);
// The highest normal utilization that keeps the survivors under a ceiling.
double MaxSafeUtilization(double ceiling, int regionCount) => ceiling * (regionCount - 1) / regionCount;
Debug.Assert(Math.Abs(AfterFailure(0.6, 2) - 1.2) < 1e-9); // two regions at 60%: the survivor is at 120%
Debug.Assert(Math.Abs(AfterFailure(0.6, 3) - 0.9) < 1e-9); // three at 60%: 90%
Debug.Assert(Math.Abs(MaxSafeUtilization(0.8, 2) - 0.40) < 1e-9); // for an 80% ceiling: 40%
Debug.Assert(Math.Abs(MaxSafeUtilization(0.8, 3) - 0.8 * 2 / 3) < 1e-9); // 53.3%
Debug.Assert(Math.Abs(MaxSafeUtilization(0.8, 4) - 0.60) < 1e-9);
Debug.Assert(Math.Abs(MaxSafeUtilization(0.8, 5) - 0.64) < 1e-9);
// The price of surviving one loss is N / (N - 1) times the capacity you need: 2x, 1.5x, 1.33x, 1.25x.
Debug.Assert(Math.Abs(2.0 / 1 - 2) < 1e-9 && Math.Abs(3.0 / 2 - 1.5) < 1e-9 && Math.Abs(4.0 / 3 - 4.0 / 3) < 1e-9 && Math.Abs(5.0 / 4 - 1.25) < 1e-9);| Regions | Load on a survivor if each ran at 60% | Highest safe normal load for an 80% ceiling | Capacity to buy per unit of load |
|---|---|---|---|
| 2 | 120% | 40% | 2.00 times |
| 3 | 90% | 53.3% | 1.50 times |
| 4 | 80% | 60% | 1.33 times |
| 5 | 75% | 64% | 1.25 times |
More regions make redundancy cheaper per unit of load, at the price of more to operate. Autoscaling does not rescue a design that lacks the headroom, because it reacts in minutes, and the receiving region may hit quotas. Capacity for a regional failure has to exist, and the quota has to be raised, before the failure. AWS calls this static stability: the surviving regions need no control-plane action, no scaling decision and no new capacity to carry on.
Five more traps in failing over:
- Retry storms and cold caches. Clients of the dead region retry into the survivor all at once, and its caches are cold. Shed load by priority, rate-limit the catch-up and protect the database (see tail latency and overload).
- Split brain. If the link between regions fails and not a region, both sides may decide to be the primary and accept writes. Prevent it with consensus-based leadership and fencing tokens, a quorum that includes a third location or a witness, and a single writer per partition. A leader that cannot reach a majority must stop writing.
- Failing over is a business decision when the RPO is not zero. Promoting a replica discards the unreplicated writes. Automate the stateless tier and the traffic shift, and for a database promotion that can lose data, decide in advance (a threshold, or a person with a runbook) whether to accept the loss or wait for the region to return.
- Failback is harder than failover. The old region must be re-seeded from the new primary, the writes it had that never replicated must be reconciled, and traffic moved back gradually. Many teams stay where they are and make the old region the standby.
- An untested failover. Missing quota, a hard-coded region name, a secret that was never replicated: the usual finds. Run game days and region evacuations on a schedule, in business hours, with the people who would be paged.
Residency. Regulations such as the GDPR restrict moving personal data out of a jurisdiction unless safeguards apply, and some countries require local storage. Legal review decides which data may leave. The design consequence is to pin each user's data to a home region, keep a minimal global directory (user to home region, with no personal data beyond what it needs), and treat every derived copy as personal data too: caches, search indexes, analytics tables, backups, logs and ML features. Keys are per region (and per tenant where deletion matters: see crypto-shredding in encryption, secrets and abuse), and the paths that support staff use to look at data must respect the boundary as well.
Control plane and data plane. The data plane serves requests. The control plane changes things: configuration, deployment, provisioning, admin. Most global outages are control-plane events, a configuration or deployment pushed to every region at once. Keep the data plane able to run without the control plane at request time (static stability again), and push changes in stages.
Cells. A cell-based design splits the whole stack into independent cells, each serving a subset of users, with no calls between cells. A failure or a bad release affects one cell, and a region holds many of them. Releases go to one cell first, then a region, then the rest, with automatic rollback when an SLO starts to burn (see SLOs and alerting). That is the answer to "what protects us from our own deploys?", which a second region does not.
| Failure | What goes wrong | Defence |
|---|---|---|
| Failing over into an overloaded region | The survivor falls over too: a cascading failure | N+1 headroom (at most 53% per region with three regions and an 80% ceiling), load shedding, pre-raised quotas |
| Split brain | Two primaries accept writes and the data diverges | Consensus with fencing tokens, a witness in a third location, one writer per partition |
| Lost writes on asynchronous failover | The survivor misses the last writes (about 200 in the test) | State the RPO, replicate synchronously what must not be lost, reconcile from the old leader's log |
| A false failover | A network glitch seen from one vantage point moves everyone | Health checks from several vantage points, thresholds, hysteresis, a gate for database promotion |
| A global configuration push or deploy | One change breaks every region at once | Staged rollouts by cell and region, automatic rollback |
| Synchronous calls across regions | A local failure becomes global and every request pays a round trip | Region-local data on the request path, asynchronous replication |
| Cold caches after failover | The database behind them is flattened | Pre-warming, request coalescing, rate limits |
| Residency broken by derived data | Logs, search indexes or backups leave the jurisdiction | A map of every copy of personal data, regional pipelines and keys |
| Untested failover | The plan fails at first use: missing quota, hard-coded region, unreplicated secret | Game days and evacuation drills |
Interviewer follow-upL5Active-passive or active-active, and how do you choose?How to answer
Choose from the recovery objectives. Active-passive (backup, pilot light, warm standby) is cheaper and simpler, with an RTO of minutes to hours and an RPO set by the replication lag. Active-active serves users from several regions at once, so it gives lower latency and a faster, smoother failover, at the price of at least double the capacity, conflict handling or home-region partitioning, and a lot more to operate. Say what RPO and RTO the business needs first, and note that most systems should start single-region and multi-AZ.
Interviewer follow-upL5What are RPO and RTO?How to answer
The recovery point objective is how much recent data you can lose, as a time (the last five seconds of writes). The recovery time objective is how long the service may be down. RPO is set by how you replicate (asynchronous replication loses the lag times the write rate: about 200 writes at 1,000 a second and 200 ms of lag in the test), and RTO is the sum of detection, decision, promotion, traffic shift and warm-up, so state each step.
Interviewer follow-upL6How do you replicate a database across regions, and what do you give up?How to answer
Asynchronous single-leader replication keeps writes fast and reads local, and loses the lag's worth of writes when the leader's region fails. Quorum replication across regions loses nothing and pays the round trip to the nearest majority on every write (70 to 130 ms in the example), with the leader's location deciding the average (165 ms against 262). Multi-leader gives local writes and needs conflict resolution. Partitioning by home region avoids conflicts by giving each record one writer. Pick per data class: a ledger synchronously, a feed asynchronously.
Interviewer follow-upL6A region goes down. Walk through the failover and say what could go wrong.How to answer
Health checks from several vantage points detect it after a threshold (30 seconds), a gate or automation decides, traffic shifts through DNS or anycast (about 90 seconds plus stragglers), the replica is promoted if the data layer needs it (accepting the RPO), and caches warm up. What goes wrong: the survivors lack headroom or quota, retries and cold caches flatten the database, a false positive or a partition causes split brain, unreplicated writes are lost, and the plan was never tested. Mitigations: N+1 capacity, shedding, fencing, a stated RPO and regular drills.
Interviewer follow-upL6Two regions each run at 60% utilization. Is that enough redundancy?How to answer
No. When one fails, the other must carry both loads, 120%, so a regional outage becomes a total one. For an 80% ceiling each of two regions should normally run at no more than 40%, and three regions at no more than 53%. Either buy the capacity before you need it (2 times for two regions, 1.5 for three), accept degraded service with load shedding, or add regions, which makes redundancy cheaper per unit of load.
Interviewer follow-upL7Design a global product where EU users' data must stay in the EU.How to answer
Partition by home region. Each user's data lives in their home region, with a replica for recovery inside the same jurisdiction. A minimal global directory maps users to regions, requests are routed or redirected there, and a cross-region user pays the round trip. Everything derived (caches, search, analytics, logs, backups, ML features) stays in region, with regional keys and access paths. Keep the control plane free of personal data, deploy by cell and region, and test residency with automated checks that look for personal data outside its region.
State the objectives, then pick the pattern. "We need an RPO of seconds and an RTO of minutes, so a warm standby with asynchronous replication, or active-active if the latency matters, with home-region partitioning to avoid conflicts. Quorum writes across regions cost 70 to 130 ms, so I would keep them for the ledger. Three regions at 53% survive losing one, two would need 40%. Traffic moves through health-checked DNS or anycast, which takes minutes. Residency is handled by pinning data to a home region, and deploys go cell by cell." Name the failure you would drill: a region evacuation.
Start from RPO and RTO, which pick the strategy: backup and restore, pilot light, warm standby or active-active, each costing more and recovering faster, with an RTO that is the sum of detection, decision, promotion, traffic shift and warm-up. Across regions, data is replicated asynchronously (cheap, loses the lag times the write rate: about 200 writes in the test), by quorum (loses nothing, pays the round trip to the nearest majority, 70 to 130 ms, with the leader's location moving the average from 165 to 262 ms), multi-leader (needs conflict resolution) or partitioned by home region (avoids conflicts). Route users to a nearby healthy region with health judged from several vantage points, keep synchronous cross-region calls off the request path, and expect cold caches after a failover. Survivors must carry the lost region's load: two regions at 60% put the survivor at 120%, and three regions must stay below 53% for an 80% ceiling, with the capacity and quota in place beforehand. Prevent split brain with fencing and a witness, treat a lossy promotion as a business decision, and know that failback is harder than failover and that an untested failover has already failed. Pin personal data to a home region including every derived copy, separate the control plane from the data plane, and limit the blast radius with cells and staged rollouts.
Try answering out loud before you reveal each answer.
QuestionA leader acknowledges 2,000 writes a second and replicates asynchronously with a mean lag of 150 ms. About how many acknowledged writes are lost if its region fails, and how do you avoid it?Reveal answer
About 2,000 × 0.15 = 300 (the expected loss is write rate times mean lag, and the tail is worse, 244 against a mean of 199 in the 1,000-write-a-second test). To lose none, replicate synchronously to at least one other region, which adds a round trip (70 to 130 ms) to every write, or limit the data that needs it (a ledger) and accept asynchronous replication for the rest.
QuestionA write quorum spans us-east, eu-west and ap-south, with round trips of 70 ms (us-east and eu-west), 190 ms (us-east and ap-south) and 120 ms (eu-west and ap-south). What is the commit latency with the leader in each region?Reveal answer
The leader needs one other region, the nearest: us-east 70 ms, eu-west 70 ms, ap-south 120 ms (its nearest is eu-west). It is the round trip to the nearest follower, not the farthest, so a leader near the writers and near a close neighbour is best.
QuestionThree regions each run at 50%. One fails. What are the survivors' loads, and is it safe against an 80% ceiling?Reveal answer
0.5 × 3 ÷ 2 = 75% each, which is under 80%, so yes. The limit is 0.8 × 2 ÷ 3 = 53.3% in normal operation. It holds only if the capacity and quotas exist in the survivors before the failure, because autoscaling takes minutes.
QuestionThe link between two regions fails, and both think the other is down. What goes wrong, and how do you prevent it?Reveal answer
Split brain: both promote themselves and accept writes, and the data diverges. Prevent it with leadership by consensus that requires a majority (a leader that cannot reach one stops writing), fencing tokens so a stale leader's writes are rejected, a witness in a third location to break ties, and a single writer per partition.
QuestionWhy is a second region no protection against a bad deploy, and what is?Reveal answer
A deploy or configuration change that goes to both regions at once breaks both. Protection is staged rollout (one cell, then one region, then the rest), automatic rollback when an SLO starts burning, and cells that limit how many users any one change can reach.
- Amazon Web Services, Disaster Recovery of Workloads on AWS: Recovery in the Cloud (opens in a new tab): RPO, RTO and the four strategies (backup and restore, pilot light, warm standby, multi-site active-active).
- James C. Corbett and others, Spanner: Google's Globally Distributed Database (opens in a new tab), OSDI 2012: synchronous replication across regions with consensus, and the cost of a wide-area write.
- Amazon Web Services, Static stability using Availability Zones (opens in a new tab), Amazon Builders' Library: pre-provisioned capacity so that failover needs no new actions. Reducing the scope of impact with cell-based architecture (opens in a new tab): cells and blast radius.
- Martin Kleppmann, Designing Data-Intensive Applications, O'Reilly, 2017, chapters 5 and 9: replication lag, multi-leader conflict resolution and consensus.