Summary#
Going multi-region means keeping data in two or more geographic regions, for three reasons: latency (serve users from nearby), disaster recovery (survive a whole region failing) and data residency (keep some data inside a country or bloc). In active-passive, one region takes writes and others hold replicas ready to take over; simple, but distant users pay write latency and failover loses the replication lag. In active-active, every region takes writes; fast and resilient, but writes to the same data in two regions conflict. Geo-partitioning gives each record a home region, which keeps writes local and conflict-free. Global databases such as Spanner (TrueTime), CockroachDB and DynamoDB Global Tables package these choices. Everything costs more: cross-region traffic, duplicate capacity and much harder operations.
Why It Exists#
Light in fibre covers about 200 km per millisecond, so a round trip between Virginia and Frankfurt takes roughly 90 ms and Virginia to Sydney about 200 ms, before any processing. A page that makes several sequential database calls across an ocean feels slow. Cloud regions also fail as a unit occasionally (power, networking, control-plane bugs), and regulations such as the EU's GDPR, and various national data-localisation laws, can require keeping personal data in a specific place. A single-region database cannot address any of these. This page builds on Quorums and Leaderless Replication and Replication.
How It Works#
Why multi-region: latency, DR and data residency#
| Goal | What it needs | Typical design |
|---|---|---|
| Read latency | Data copies near users | Read replicas or caches in each region |
| Write latency | Writes accepted near users | Active-active or geo-partitioning |
| Disaster recovery | A copy and capacity elsewhere, plus a failover plan | Active-passive with async replication (RPO = lag) or synchronous multi-region (RPO = 0) |
| Data residency | Some rows stored only in certain regions | Geo-partitioning by user's jurisdiction |
Be precise about which goal you have; each leads to a different design and cost. DR targets are expressed as RPO (how much data you can lose) and RTO (how long recovery can take). See Disaster Recovery.
Why multi-region, in depth#
The latency budget. Inside one availability zone (AZ), a network round trip is well under a millisecond. Across AZs in the same region it is about 1 to 2 ms. Across regions it is 50 to 150 ms on the same continent pair or ocean crossing, and over 200 ms to the far side of the planet. Those numbers are set by physics and routing, not by your code. Consider a European user loading a page served from Virginia that makes four sequential database calls:
| Setup | Per call | Page total for 4 sequential calls |
|---|---|---|
| App and DB in the user's region | ~2 ms | ~8 ms |
| App near user, DB in another region | ~90 ms | ~360 ms |
| App and DB both far away (one user-to-app round trip of ~90 ms, then local calls) | ~2 ms + 90 ms | ~100 ms |
Two lessons follow. First, the worst layout is a split layout where the application is near users but the database is far away, because every query pays the ocean. If you can only have one database region, keep the application next to it, and let users pay the long trip once per request. Second, multi-region data matters most for write-heavy, interactive paths. Reads can often be served from caches, CDNs or read replicas near the user.
What "disaster" actually means. Most failures are smaller than a region: a disk, a host, a rack, an AZ. Running across three AZs in one region already survives all of those, and costs far less than a second region. Whole-region failures are rare but real. The AWS us-east-1 S3 outage of 28 February 2017 began when a mistyped maintenance command removed more servers than intended. The us-east-1 event of 7 December 2021 was triggered by an automated scaling activity that congested AWS's internal network. Both impaired many dependent services for hours. Note that neither involved the destruction of a data centre. A region "fails" far more often through software, control planes and dependencies than through fire or flood. That shapes the design: your failover must not itself depend on the failing region's control plane.
Two numbers that frame DR.
- RPO (recovery point objective): how much recent data you can afford to lose, measured in time. Asynchronous replication gives an RPO about equal to replication lag, usually under a second to a few seconds. Synchronous replication gives an RPO of zero.
- RTO (recovery time objective): how long until service is restored. It covers detection, the decision to fail over, promotion, routing changes and cache warm-up. Unpractised failovers commonly take hours. Rehearsed, automated ones take minutes.
Classic DR strategies form a ladder of cost and RTO. AWS's disaster recovery guidance names four rungs:
- Backup and restore: copy backups to another region and rebuild on disaster. Cheapest. RTO is hours, and RPO is the backup interval.
- Pilot light: data replicates continuously to the second region, but compute is off or minimal. RTO is tens of minutes while capacity starts.
- Warm standby: a scaled-down but running copy of the whole stack. RTO is minutes, mostly scaling up.
- Multi-site active-active: full capacity serving traffic in several regions. RTO is near zero for routing, but you pay for conflicts or global consensus.
Data residency is about where bytes live, not where users are. Laws differ in strength. The EU's GDPR does not strictly require data to stay in the EU. It restricts transfers outside the European Economic Area unless safeguards apply. The 2020 Schrems II ruling by the Court of Justice of the EU invalidated the EU-US Privacy Shield, and the EU-US Data Privacy Framework replaced it in 2023. Other laws are stricter localisation rules. Russia's Federal Law 242-FZ (in force since September 2015) requires personal data of Russian citizens to be stored in databases located in Russia. China's Personal Information Protection Law (in force since November 2021) restricts and conditions cross-border transfers. For a designer the practical point is that residency applies to every copy: primary rows, replicas, backups, logs, search indexes, caches, analytics exports and support tooling. A design that geo-partitions the main database but ships all logs to a US cluster is not compliant. Legal teams decide the rules. Engineers must make the data map visible so the rules can be enforced.
Read scale versus write scale across regions. Reads are easy to globalise: put replicas or caches in every region and accept a little staleness. Writes are the hard part, because a write must be ordered relative to other writes on the same data, and ordering across an ocean takes at least one ocean round trip, unless you give up ordering (active-active with conflicts) or make the data not shared (geo-partitioning). Every multi-region design is a choice about where that round trip goes.
Active-passive vs active-active#
Active-passive (primary-standby):
- One region holds the primary; others have asynchronous replicas that can serve stale reads.
- Writes from far regions pay a cross-region round trip (around 100 ms or more).
- On region failure, promote a standby: RPO equals replication lag (seconds), RTO is detection plus promotion plus DNS or routing change (minutes, if practised).
- Simple, no conflicts, the most common starting point. Example: Aurora Global Database (cross-region replication typically under a second) or a cross-region Postgres replica.
- Warm standby (running, scaled down) vs hot standby (full capacity) is a cost vs RTO choice.
Active-active (multi-primary):
- Each region serves reads and writes locally; changes replicate to the other regions asynchronously.
- Low latency everywhere and no failover needed: if one region dies, users are routed to another.
- But two regions can update the same record within the replication window, so conflicts must be resolved (see below), and constraints like "unique username" or "balance never negative" cannot be enforced locally.
Many systems are a mix: active-active for stateless services and conflict-tolerant data, with one home region for strongly consistent data.
Active-passive and active-active, in depth#
Anatomy of a regional failover. A failover is a protocol, not a button. The dangerous moment is when both regions believe they are primary (split brain), so the old primary must be fenced, meaning prevented from accepting writes, before the new one opens.
Each step has traps:
- Detection must use several vantage points. A probe failing from one place may mean the prober is broken. Many teams keep the final decision with a human for full-region failover, because a false failover costs data (the lag) and time.
- Fencing can use the database's own mechanism, such as a lease that expires, a revoked IAM role, or a storage-level write lock. If you cannot fence, you must at least route away and accept that a partitioned old primary may still take a few writes from clients that still reach it.
- Promotion usually has a "position": the last replicated log sequence number. Anything the old primary committed after that is not in the new primary. Those writes are either lost or recovered later from the old primary's log and replayed or reviewed by hand.
- Routing through DNS is limited by TTLs and by clients that cache addresses longer than the TTL. Global load balancers and anycast front doors switch faster because the client's address does not change.
- Warm-up: caches in the standby region are cold, connection pools are empty and auto-scaling lags. The first ten minutes after failover often hurt more than the outage.
Failback is the forgotten half. After Region A recovers, it is now behind and has possibly divergent writes. It must be rebuilt as a replica of B, and moving the primary back is another planned failover. Planned switchovers (with zero lag, because you pause writes, wait for replicas to catch up, then switch) are the best way to rehearse. Running a planned switchover every quarter turns the emergency procedure into a routine.
Managed active-passive. Aurora Global Database replicates storage-level changes to secondary regions, typically with under a second of lag. It supports both a managed switchover for planned moves and a promote-the-secondary path for real outages. It also offers write forwarding, so applications in a secondary region can send writes that the primary applies, at cross-region latency. Cloud SQL and Azure SQL offer cross-region replicas with promotion. With self-managed PostgreSQL, the same pattern uses streaming replication plus a failover manager such as Patroni, with care that the failover manager's own consensus store is not in the failed region.
Flavours of active-active.
- Partitioned active-active (home region). Every region accepts writes, but each record has one home region and writes for it go there. This is geo-partitioning, and it has no conflicts.
- Read-local, write-anywhere with async merge. Any region writes any record, and conflicts are resolved after the fact (LWW, CRDTs, merge logic). Examples are DynamoDB Global Tables and Cassandra multi-DC with
LOCAL_QUORUM. - Consensus across regions. Writes need a quorum that spans regions (Spanner, CockroachDB, multi-region etcd). There are no conflicts, but each write pays at least one cross-region round trip unless leaders and quorums are placed cleverly.
Real systems combine them. Netflix has described its active-active setup: stateless services in each region, Cassandra replicating between regions, and the ability to shift all traffic out of a region. Netflix also runs regular exercises (called Chaos Kong) that evacuate a whole region to prove that this works.
Stateless tiers are easy, state is the design. Running the web and API tier in every region costs capacity but adds little complexity. The questions all live in the data tier, plus the "hidden state" teams forget: session stores, rate-limit counters, job queues, scheduled jobs (which must not run twice, once per region), search indexes and feature-flag stores. For each one, decide whether it is regional, global with one writer, or replicated with conflict rules.
Geo-partitioning#
Geo-partitioning stores each row in a chosen region based on a column, typically the user's home region. An EU user's profile, orders and messages live in EU nodes; a US user's in US nodes.
- Writes and reads for a user's own data stay in-region: low latency, single-writer, no conflicts.
- Satisfies residency by keeping rows physically in their region.
- Cross-region access still works, at cross-region latency (a US user viewing an EU user's profile).
- Hard parts: users who move (migrate their rows), data shared across regions (a group chat with members on three continents needs one home), and global uniqueness (usernames, emails) which needs a global table or a single authority.
CockroachDB supports this with REGIONAL BY ROW tables; Spanner and YugabyteDB offer similar placement; with DynamoDB or Postgres you build it with a region-aware router and separate regional clusters.
-- CockroachDB: multi-region database with geo-partitioned rows
ALTER DATABASE app SET PRIMARY REGION "eu-west1";
ALTER DATABASE app ADD REGION "us-east1";
ALTER DATABASE app ADD REGION "ap-southeast1";
ALTER TABLE users SET LOCALITY REGIONAL BY ROW; -- hidden crdb_region column decides home
ALTER TABLE currencies SET LOCALITY GLOBAL; -- fast reads everywhere, slower writesGeo-partitioning, in depth#
Choosing the home region. The home region is a property of the data owner (user, tenant, organisation), not of the request. Common rules:
- The country chosen at signup or billing country, which is the most stable and also what residency rules key on.
- The region nearest the signup IP, which gives good latency but is wrong for travellers and VPN users.
- For B2B products, the tenant's contractual region, often chosen by the customer ("EU data centre" plans).
Store the choice explicitly, for example as home_region = 'eu' on the account. Do not derive it on the fly, because the derivation will change and old data will not move with it.
Routing requests home.
Put the home region in the session token at login. Then most requests can be routed without any lookup, and the global directory (account ID to home region) is consulted only at login or on a cache miss. The directory is small, read-mostly and globally replicated. It is a good fit for a strongly consistent global table that is written rarely. A forwarded request crosses the provider's backbone once, which is usually faster than the public internet.
Moving a user. A user who relocates from Paris to Singapore, or a customer that changes contract region, needs their data moved. The procedure mirrors an online shard move:
- Copy a snapshot of the account's rows to the target region.
- Stream changes (CDC) from the old region until the copy is caught up.
- Briefly block writes for the account (seconds), apply the last changes, flip
home_regionin the directory, and invalidate cached tokens. - Verify the counts and checksums, then delete the old copy, which residency requires.
Make relocation a tested, automated workflow. Doing it by hand for a few accounts a month invites mistakes. See Data Migration.
Shared objects need a home too. A group chat with members in three regions, a shared document, or a marketplace order between a buyer in Japan and a seller in Germany belongs to no single user. Options:
- Home it where it was created, which is simple and usually good enough.
- Home it where most activity comes from, migrating if that changes.
- Split it: the order lives with the buyer, and a copy of the fulfilment record lives with the seller, linked by events.
Members far from the home pay cross-region latency on writes. For chat, a common trick is to accept the message at the nearest region, deliver it to nearby recipients immediately, and forward it to the home region for durable ordering.
Global uniqueness. Usernames, email addresses and vanity URLs must be unique worldwide, but rows live in regional databases. Keep a global uniqueness table (username to account) in a strongly consistent store such as Spanner or a CockroachDB GLOBAL table, or in a single region. Insert into it first. Only after that succeeds, create the regional account. Signups pay one cross-region round trip, which is fine for an action done once.
IDs without coordination. Generated IDs need not be global-consistent, only unique. Embed a region number in the ID (Snowflake-style layouts reserve bits for a data-centre ID), or allocate disjoint ranges per region: region A uses counters 0 to 1 billion, region B 1 billion to 2 billion. A URL shortener can then mint short codes locally in each region without ever talking to the others. See Unique ID Generation.
Table localities. CockroachDB names three placements, a vocabulary that is useful even with other databases:
| Locality | Where data lives | Reads | Writes | Use for |
|---|---|---|---|---|
REGIONAL BY ROW | Each row in its own home region | Fast in home region | Fast in home region | Per-user and per-tenant data |
REGIONAL BY TABLE | Whole table in one region | Fast in that region | Fast in that region | Data used mostly in one place |
GLOBAL | Replicated everywhere | Fast everywhere, still consistent | Slow (waits for clocks and replication) | Reference data, uniqueness tables, config |
Analytics and residency. Analysts want one global view. A residency-aware design keeps raw personal data in regional warehouses and exports only aggregated or pseudonymised data to a central one. Alternatively it runs federated queries that push computation to each region and return only results. Decide this early, because retrofitting it means auditing every pipeline.
Global databases#
| Google Spanner | CockroachDB | DynamoDB Global Tables | |
|---|---|---|---|
| Model | Distributed SQL, externally consistent (strict serializability) | Distributed SQL, serializable | Key-value / document, multi-active |
| Replication | Paxos per data split across regions | Raft per range across regions | Asynchronous between regions (typically about a second) |
| Writes | Leader replica of each split; quorum across regions | Leaseholder of each range; Raft quorum | Any region; last writer wins |
| Consistency across regions | Strong | Strong | Eventual (strong within a region); AWS added a multi-region strong consistency option in 2025 |
| Cross-region write latency | Quorum round trip, tens to 100+ ms | Quorum round trip, unless geo-partitioned | Local, single-digit ms |
| Fits | Global strongly consistent OLTP on Google Cloud | Strong SQL across regions or clouds, geo-partitioning | Low-latency global key-value with tolerable conflicts |
Spanner and TrueTime. Spanner assigns each transaction a commit timestamp and guarantees that timestamp order matches real-time order. It does this with TrueTime, an API backed by GPS receivers and atomic clocks in Google's data centres that returns an interval [earliest, latest] guaranteed to contain the true time, with uncertainty usually a few milliseconds. On commit, Spanner waits out the uncertainty ("commit wait") before making the result visible, so no later transaction anywhere can get an earlier timestamp. This gives globally consistent snapshots and lock-free consistent reads at a timestamp.
CockroachDB cannot assume atomic clocks. It uses hybrid logical clocks with a maximum clock offset (500 ms by default); when a read sees a value with a timestamp inside its uncertainty window, it restarts at a later timestamp. It provides serializable isolation; follower reads and global tables trade freshness or write speed for local reads.
DynamoDB Global Tables replicate a table to several regions, each fully writable. Concurrent writes to the same item are resolved by last writer wins on timestamps. It is the simplest way to get local writes everywhere, as long as your data model tolerates that.
See Time and Ordering and Consensus.
Global databases, in depth#
Spanner's structure. Spanner splits tables into key ranges called splits. Each split is replicated by its own Paxos group, with replicas placed according to the instance configuration. Each Paxos group has a leader holding a time-based lease (10 seconds by default in the original paper). The leader orders writes and holds the lock table for that split. A transaction touching one split commits with one Paxos round. A transaction touching several splits runs two-phase commit where every participant is a Paxos group, so no single machine failure blocks it (see Distributed Transactions).
TrueTime and commit wait, step by step. TT.now() returns an interval [earliest, latest]. The 2012 paper reported uncertainty that typically varied between about 1 and 7 ms, averaging about 4 ms. To commit a read-write transaction:
- The leader takes locks and picks a timestamp
sno earlier thanTT.now().latest. - It replicates the commit through Paxos.
- It waits until
TT.now().earliestis greater thans, so the true time has certainly passeds. Only then does it release locks and reply.
Because every later transaction anywhere picks a timestamp at least its own TT.now().latest, and that is after true time, which is after s, timestamps respect real-time order. The wait is roughly twice the uncertainty, a few milliseconds, and it usually overlaps the Paxos round trip, which takes longer anyway. That is the cost of external consistency, paid in milliseconds rather than in an extra cross-region round trip.
Lock-free snapshot reads. A read-only transaction picks a timestamp and reads from any replica that is sufficiently up to date. Each replica tracks a safe time: the timestamp up to which it knows it has seen all writes. If the replica's safe time has passed the read timestamp, it answers locally, with no leader and no locks. Stale reads ("as of 10 seconds ago") almost always qualify, which is why they are cheap even in far regions.
Spanner multi-region configurations. Multi-region instances place read-write replicas (which vote and can lead) in a couple of regions close together, read-only replicas (which serve local reads but do not vote) in other regions, and sometimes a witness replica that votes but does not store a full readable copy, so a quorum survives a region loss without the cost of a third full replica. Writes are fast for clients near the leader region and pay one round trip from further away. Choosing the leader region is the main latency decision.
CockroachDB's version of the same ideas. Data is split into ranges (512 MiB by default in recent versions), each replicated by Raft. One replica holds the lease and serves consistent reads and coordinates writes. Without atomic clocks, CockroachDB uses hybrid logical clocks plus a configured maximum clock offset. A read that encounters a value whose timestamp falls inside its uncertainty window restarts at a higher timestamp, so occasional retries replace commit wait. For GLOBAL tables, it writes at a timestamp slightly in the future, and non-voting replicas in every region can serve consistent reads locally once that time arrives. That makes reads fast everywhere, at the price of slower writes, which wait out the future timestamp. Survival goals state the failure model: SURVIVE ZONE FAILURE keeps a range's voters in one region (fast writes, survives an AZ), and SURVIVE REGION FAILURE spreads voters over at least three regions (survives a region, and writes pay a cross-region quorum).
DynamoDB Global Tables. Each replica table is writable. Changes replicate asynchronously to the other replicas, typically within a second, and AWS publishes a ReplicationLatency metric per region pair. Concurrent updates to the same item resolve by last writer wins at the item level. A conditional write (attribute_not_exists, a version check) is evaluated only against the local replica, so two regions can both pass the same condition. That is the classic way to double-book a resource with Global Tables, and it is why invariants still need a single authority. AWS later added a multi-region strong consistency mode, where writes are synchronously replicated before acknowledgement, at higher write latency. The DynamoDB guidance for interviews is that naming Global Tables is usually enough for cross-region replication, but you should know the LWW and conditional-write caveat.
Other systems worth knowing.
- Cassandra and ScyllaDB:
NetworkTopologyStrategysets a replica count per data centre.LOCAL_QUORUMkeeps reads and writes in-region and replicates to others asynchronously.EACH_QUORUM(for writes) waits for a quorum in every DC, which is consistent but slow. Conflicts resolve per cell with LWW timestamps. - Azure Cosmos DB: offers five consistency levels (strong, bounded staleness, session, consistent prefix, eventual) and optional multi-region writes with conflict policies (LWW on a chosen property, or a custom merge procedure).
- MongoDB: zone sharding pins shard-key ranges, for example by country prefix, to shards in particular regions, which is geo-partitioning on a document database.
- YugabyteDB: synchronous multi-region clusters (Raft across regions) or asynchronous xCluster replication between independent clusters, which is active-passive or active-active with LWW.
Which fits? If the business needs SQL, global invariants and can accept 50 to 150 ms writes from some regions, use Spanner or CockroachDB with geo-partitioned rows to make most writes local. If writes must be local everywhere and the data tolerates LWW or merge, use DynamoDB Global Tables, Cassandra or Cosmos DB with multi-region writes. If DR is the main goal and one write region is fine, use Aurora Global or cross-region PostgreSQL replicas, the simplest and cheapest option.
Conflict handling#
Whenever two regions accept writes for the same data, plan conflicts explicitly:
- Avoid them: route all writes for a record to its home region (geo-partitioning, "sticky" home region per user or tenant). This is the most effective strategy.
- Make writes commutative: increments, set additions and append-only logs merge naturally; CRDTs formalise this.
- Last writer wins: acceptable for profile fields and settings, where losing a concurrent edit is fine. Use synchronised clocks; know it silently drops data.
- Application merge: keep both versions and merge with domain logic (union of cart items).
- Single global authority for invariants: usernames, inventory counts and money balances go through one region or a strongly consistent global database.
A related trap is the read-after-failover anomaly: after a regional failover, users may see their recent writes vanish (unreplicated lag) and then reappear; make that rare and explain it in runbooks.
Conflict handling, in depth#
What a conflict looks like. With asynchronous replication taking about one second:
- At 12:00:00.100, a user in London sets their display name to "Ana" in EU-West.
- At 12:00:00.400, their phone, routed to US-East through a VPN, sets it to "Ana M.".
- Each region accepts its write and replicates it to the other.
- With LWW on timestamps, both regions converge to "Ana M." (the later timestamp), and "Ana" silently disappears.
For a display name that is fine. Now replace the display name with a stock count. Two regions both read stock = 1, both sell the item, and both write stock = 0. LWW converges to 0, but two items were sold and one does not exist. LWW converges, but it does not preserve intent. Converging on a wrong answer is still wrong.
How often do conflicts happen? Roughly, a conflict needs two writes to the same key in different regions within one replication window. If one key gets writes at rate λ from each of two regions, and the lag is L, the chance that a given write has a concurrent partner is about λL (for small λL). For a profile updated once a day with 1 second of lag, that is about 1 in 86,400: rare, so LWW is acceptable. For a shared counter updated 50 times per second, λL is about 50, so nearly every write conflicts, and LWW would lose almost all of them. This estimate tells you which data can be multi-active.
Clock skew makes LWW worse. LWW picks the higher timestamp, and wall clocks drift. If US-East's clock runs 300 ms fast, its writes win against EU writes made up to 300 ms later. A user can then change a setting and watch it revert. Mitigations are tight clock synchronisation (cloud time services with microsecond-level accuracy are now available on major clouds), hybrid logical clocks that never go backwards, and LWW per field rather than per row, so concurrent edits to different fields both survive.
Commutative designs. Turn conflicting overwrites into merges:
- Counters: keep a per-region count and sum them (a G-counter, or a PN-counter if there are decrements). Every region increments only its own slot, so there is never a conflict.
- Sets: use an observed-remove set (OR-Set), where adds and removes carry unique tags. A concurrent add and remove resolves predictably, typically with add winning.
- Logs: append-only events with unique IDs merge by union. Order them by a hybrid timestamp for display.
See Collaborative Editing and CRDTs for the theory.
Splitting invariants across regions (escrow). A global stock of 1,000 tickets does not have to live in one region. Give each region a quota: EU 400, US 400, APAC 200. Each region sells against its own quota locally, with no coordination and no oversell. A background process rebalances, moving unsold quota from a quiet region to a busy one, using a strongly consistent transfer. The idea dates back to O'Neil's The Escrow Transactional Method (ACM TODS, 1986). The same trick works for credit limits, rate limits and budgets. The only cost is that a region can run out of quota while another still has some, until rebalancing catches up.
Detecting and surfacing conflicts. Even with LWW, log every overwrite where the losing version was not an ancestor of the winning one. Version vectors or the database's conflict feed (Cosmos DB exposes one) make that possible. A rising conflict rate means routing is broken, for example a load balancer sending a user's requests to two regions, long before users complain.
Replication loops. In a home-grown active-active setup (say two PostgreSQL clusters with logical replication both ways), a change replicated from A to B must not be replicated back to A. Tag each change with its origin and filter out changes that originated at the target. PostgreSQL 16 added an origin option on subscriptions for exactly this. Also roll out schema changes so that both directions keep working mid-migration: add columns before writing them, and drop them only after every region has stopped reading them.
Cost and complexity#
- Data transfer: cross-region replication is billed per GB on most clouds (often around $0.02 per GB between AWS regions; check current pricing). A write-heavy database replicating 10 TB a month to two regions adds noticeable cost.
- Duplicate capacity: active-active needs every region sized to absorb another's traffic on failover (N+1 regions); active-passive needs at least warm standby capacity.
- Latency of strong consistency: synchronous cross-region quorums add 50-200 ms per write.
- Operations: failover drills, schema changes rolled across regions, region-aware routing, monitoring per region, and conflict debugging.
- Engineering: every feature must answer "which region is the source of truth?"
Rule of thumb: start with one region across several availability zones (which already handles most failures), add cross-region DR when the business needs it, and go active-active only for clear latency or availability requirements.
Cost and complexity, in depth#
A worked transfer bill. A service writes 5,000 rows per second at about 1 KB each, which is 5 MB per second, and replicates to two other regions.
- 5 MB/s × 2.6 million seconds in a month is about 13 TB per month of changes.
- Two destinations means about 26 TB of cross-region transfer.
- At roughly $0.02 per GB, that is about $520 per month for the base data.
The real figure is usually higher. Replication streams carry more than row data: write-ahead log records, index updates, full-page images after checkpoints, and protocol overhead. Two to three times the logical volume is common. Then add backups copied to another region, CDC streams, logs and metrics shipped centrally, and cross-region service-to-service calls. Cross-region transfer is often a top-five line item on a multi-region bill, so measure it per service.
Capacity math for failover. If N active regions share load evenly and one fails, each survivor must absorb a share of the failed region's load.
| Active regions | Normal load per region | Load after losing one | Max safe normal utilisation |
|---|---|---|---|
| 2 | 50% | 100% | 50% |
| 3 | 33% | 50% | 66% |
| 4 | 25% | 33% | 75% |
With two regions you pay for double capacity. With three, the overhead drops to 1.5 times. This is one reason large services run three or more regions, even though two would satisfy "survive a region". It also applies to databases. A region that will absorb another's users needs storage and IOPS headroom, not just stateless capacity.
Dependencies are the hidden single region. A multi-region data tier does not help if login calls an identity service that runs only in us-east-1, or if deployments need a CI system, secrets manager or container registry in the failed region. Audit the critical path: DNS, certificates, identity, secrets, feature flags, payment providers, queues, and the observability stack you need during the outage. The AWS Builders' Library calls the goal static stability: a system that keeps working through a failure without having to make changes, such as launching instances or editing configuration, because those control-plane actions are often what is impaired.
The engineering tax. Every feature now has to answer:
- Which region is the source of truth for this data?
- What happens to this flow if that region is down, or 200 ms away?
- Is this background job scheduled once globally or once per region?
- Does this new column or table respect residency?
Teams that do well with multi-region make these questions part of design review with a short checklist, and test them with region evacuation drills: shift all traffic out of one region during business hours, measure latency, errors, data loss and RTO, then shift it back.
When it is cheaper to stay single-region. A three-AZ single-region deployment with backups copied to a second region (backup-and-restore DR) costs perhaps 5 to 10% more than no DR, and handles everything except a multi-hour regional outage. Many businesses rightly accept that risk. Move up the ladder when the cost of a regional outage, in revenue, contracts or regulation, clearly exceeds the ongoing cost of the next rung.
Read-your-writes across regions#
The anomaly. A user in Sydney updates their profile. The write goes to the home region in Singapore. The next page load is served from a Sydney read replica that is 800 ms behind, so the old profile appears, and the user thinks the save failed. Cross-region replicas make this far more likely than in one region, because lag is larger and requests may land in different regions from one moment to the next.
Techniques, from simplest to most precise.
- Read from home after writing. For a short window after a write, say 5 to 10 seconds tracked in a cookie, route that user's reads to the home region. This is simple and effective, and costs a cross-region trip only for recent writers.
- Sticky routing. Always serve a user from their home region, for reads too, and use local replicas only for other users' data, such as viewing someone else's profile. Staleness then only affects data the viewer did not just write.
- Version tokens. The write returns a position: a log sequence number, commit timestamp or version. The client sends it with subsequent reads. A replica serves the read only if it has applied that position, and otherwise waits briefly or forwards the read to the leader. This is precise, and it is how session consistency works in systems such as Azure Cosmos DB, where the SDK carries a session token.
- Bounded staleness reads. Ask the database for data no more than N seconds old (Spanner's bounded-staleness reads, CockroachDB follower reads, Cosmos DB bounded staleness). This suits pages where a few seconds is acceptable and you want the read to be served locally.
Monotonic reads. A related anomaly is seeing a new value, then an older one on the next request, because two requests hit replicas with different lag. Pinning a session to one replica, or sending the highest version seen with each read, prevents this. See Consistency Models for the full set of session guarantees (read-your-writes, monotonic reads, monotonic writes, writes-follow-reads) and how they compose.
Caches are replicas too. A regional cache in front of a regional replica adds another layer of staleness. On a write, publish an invalidation event to every region's cache, or give cache entries short TTLs for user-editable data. Otherwise the replica catches up while the cache keeps serving the old value. See Distributed Caching.
Operating multi-region data day to day#
Watch replication like a product metric. Track lag per region pair, as both time and bytes, with alerts well below your RPO. If RPO is 5 seconds, alert at 1 second sustained. Lag spikes usually come from large batch jobs, schema changes that rewrite tables, network congestion between regions, or a replica's disk falling behind. A dashboard showing lag next to the write rate makes the cause obvious.
Verify, do not assume, that regions agree. Replication bugs and manual fixes cause silent divergence. Run periodic consistency checks: compare row counts and checksums per key range between source and replica, or between two active-active regions. Merkle-tree style comparisons (hash ranges, then drill into ranges that differ) keep the cost proportional to the differences rather than to the data size. Vitess's VDiff and Cassandra's repair use this idea. See Quorums and Leaderless Replication.
Deploy region by region. Ship application and schema changes to one region first, watch it, then roll out to the rest. That limits the blast radius, but it means two versions of code and schema coexist across regions for hours. Every change must be backward- and forward-compatible with the replication stream. Expand-and-contract migrations (add the new column, write both, backfill, switch reads, remove the old) are mandatory rather than optional. Never run a long, table-rewriting DDL on a primary without understanding what it does to replica lag in other regions.
Backups are per region and per residency zone. Take backups in each region where a primary lives, copy them to a second region inside the same residency zone, and test restores regularly. Point-in-time recovery from a log archive gives an RPO of minutes even if every replica is corrupted by a bad write. Replication faithfully copies mistakes, so only backups protect against them.
Run game days. A well-run programme includes: a planned switchover of each database each quarter; an unannounced region evacuation of traffic, in staging first and later in production; a restore from backup into a fresh account; and a test that the runbook works with the primary region's console and tooling unavailable. Record the measured RPO and RTO each time. They are the only numbers you can honestly promise.
Blobs, caches and search across regions#
Databases get the attention, but most bytes in a global product are files: images, videos, attachments, backups. An object storage bucket such as Amazon S3 lives in one region, with automatic replication across that region's AZs. A Tokyo viewer streaming a video stored in Virginia pays the ocean on every segment. There are two standard fixes, often used together:
- A CDN in front of the bucket caches popular objects at edge locations near viewers. That handles the read side for public, cacheable content cheaply, and is usually the first step.
- Cross-region bucket replication copies new objects asynchronously to buckets in other regions, typically within minutes. This serves origin fetches locally, survives a regional storage outage, and keeps a residency-correct copy. S3 Replication Time Control offers a 15-minute replication SLA for most objects.
Upload paths have the same home-region question as rows. Either upload to the uploader's nearest region and replicate outward, recording the object's home in its metadata row, or always upload to the owner's home region for residency.
Caches should be regional and treated as disposable. Do not replicate cache contents across regions. Instead, rebuild them from the regional database, and replicate invalidations. Search indexes (Elasticsearch, OpenSearch) are usually per region and built from the regional database through CDC. A global search then queries each region's index and merges results, which is a scatter-gather with the usual tail-latency issues, or reads a central index of non-personal fields only.
Worked design: a global social app#
Requirements. 200 million users, 40% in Europe, 35% in the Americas and 25% in Asia-Pacific. Posting and messaging must feel instant (p99 write under 150 ms end to end). EU personal data must stay in the EU. The service must survive a full region failure with an RPO of a few seconds and an RTO under 15 minutes.
Classify the data.
| Data | Rule | Placement |
|---|---|---|
| Profiles, posts, messages, settings | Owned by one user | Geo-partitioned by home_region |
| Usernames, emails | Globally unique | Global strongly consistent table, written on signup or rename |
| Follower graph edges | Between users in different regions | Stored with the follower, with a copy event to the followee's region |
| Like counts | High write rate, tolerant | Per-region counters, summed (G-counter) |
| Feature flags, country lists | Read everywhere, rarely written | Global replicated, read locally |
| Feeds | Derived, rebuildable | Regional cache built from events |
Topology.
Key flows.
- Posting: a London user's post is written to the EU database, which is local (about 5 ms). A
PostCreatedevent goes through an outbox to the cross-region bus. Followers in the US see it in their feeds a second or two later, which is fine for a feed. - Messaging between regions: a conversation is homed where it was created. A Tokyo user replying to a London-homed chat sends the message to the nearest region, which forwards it to the EU home for ordering, adding about 200 ms. That is within budget for chat, and delivery to the Tokyo user's own devices can be immediate.
- Signup: the username is inserted into the global table first (one cross-region round trip, about 100 ms), then the account is created in the home region.
- Region failure: if the US region fails, the US DR region is promoted (RPO of about a second of lag) and routing switches. EU and APAC users are unaffected. EU residency holds because the EU DR partner is also inside the EU.
What this design refuses to do. It never lets two regions write the same user's data. It never runs a uniqueness check or a balance check against a local replica of global data. It never sends EU rows, backups or logs outside the EU. Each of those is a decision you can state in one sentence in an interview, and each removes a class of bugs.
When to Use It#
- Users on several continents with latency-sensitive writes.
- RTO/RPO requirements that a single region cannot meet (surviving a regional outage).
- Legal requirements to keep data in specific jurisdictions.
- Global products where a regional outage would be a major business event.
When NOT to Use It#
- Early-stage products: multi-AZ in one region gives high availability at a fraction of the cost.
- When the only goal is read latency for static or cacheable content; a CDN is far cheaper.
- When most data is shared globally and must be strongly consistent, and users cannot tolerate 100 ms writes.
How to Implement It#
- Write down goals: latency targets per region, RPO/RTO, residency rules.
- Classify data: per-user (geo-partition), global reference (replicate everywhere), global invariants (single authority).
- Choose the topology: active-passive for DR; geo-partitioning or active-active for write latency.
- Pick the database: Aurora Global or Postgres replicas (active-passive), CockroachDB or Spanner (strong, geo-partitioned), DynamoDB Global Tables or Cassandra multi-DC (multi-active).
- Route users to their home region with GeoDNS or a global load balancer and a home-region lookup.
- Practise failover regularly and measure real RPO and RTO.
| Technology | Fits when |
|---|---|
| Aurora Global Database, Cloud SQL cross-region replicas | Active-passive SQL with fast regional failover |
| Spanner | Strong global consistency on Google Cloud |
| CockroachDB, YugabyteDB | Geo-partitioned, strongly consistent SQL, multi-cloud |
| DynamoDB Global Tables | Multi-active key-value with LWW |
| Cassandra / ScyllaDB multi-DC | Multi-active wide-column with LOCAL_QUORUM |
Trade-offs#
| Choice | Gain | Cost | Pick when |
|---|---|---|---|
| Active-passive | Simple, no conflicts | Remote write latency, failover RPO = lag | DR first, single write region acceptable |
| Active-active | Local writes, no failover pause | Conflicts, weaker invariants | Conflict-tolerant data, global users |
| Geo-partitioning | Local writes, no conflicts, residency | Cross-region access slower; moving users | Data that belongs to a user's region |
| Global strong database | Simple correctness model | Write latency, cost, vendor choice | Global invariants with SQL |
| Per-region quotas (escrow) | Local, coordination-free decrements with no oversell | Stranded quota until rebalance | Global stock, budgets, rate limits |
| Pilot light or warm standby DR | Cheap regional survival | RTO of minutes to tens of minutes | DR required, latency not |
| Region-local voters plus async DR | Fast quorum writes, survives AZ loss | Seconds of RPO on region loss | Most user data with a home region |
Common Pitfalls#
- Going active-active without deciding how each data type resolves conflicts.
- Enforcing uniqueness or balances locally in each region.
- Never testing failover, then discovering DNS TTLs, hard-coded endpoints and cold caches during a real outage.
- Forgetting that dependencies (auth, payments, queues) also need to be multi-region.
- Underestimating cross-region transfer cost.
- Checking conditions (uniqueness, stock) against a local replica in an asynchronously replicated multi-writer table.
- Running scheduled jobs in every region so they fire twice.
- Leaving logs, backups or search indexes outside the residency boundary.
- Failover that depends on the failed region's control plane, DNS or secrets.
- Sizing two active regions at 70% each, so neither can absorb the other.
Real-World Examples#
Google's Spanner paper (OSDI 2012) introduced TrueTime and commit wait to provide externally consistent transactions across data centres; Spanner is offered as Cloud Spanner.
Netflix has described running active-active across multiple AWS regions, with Cassandra replicating data between regions and the ability to evacuate traffic from a failing region.
Google's F1 paper (VLDB 2013) describes running the AdWords backend on Spanner with replicas spread across data centres. It accepts higher commit latency than a local MySQL in exchange for strong consistency, and recommends schema and batching choices to hide that latency.
In the Interview#
Handling multi-region in an interview#
Ask which goal is driving it. "Is multi-region here about latency for global users, surviving a region outage, or data residency?" The answers lead to different designs. DR alone suggests active-passive. Latency for writes suggests geo-partitioning. Residency suggests geo-partitioning with an audit of every copy. Interviewers often add "the app is global" casually, and a candidate who asks this question shows judgement.
Say where writes go, for every type of data. Walk through a short classification. User-owned data is homed in the user's region. Global unique keys go to one strongly consistent table. Counters are per region and summed. Reference data is replicated everywhere. Derived data is rebuilt from events in each region. That one-minute table answers most follow-up questions before they are asked.
Put numbers on it. "Cross-region round trips are 70 to 150 ms. A geo-partitioned write is local, about 5 ms. A Spanner-style write from a far region pays one quorum round trip. Asynchronous replication lag is about a second, so DR RPO is about a second." Concrete numbers make the trade-offs believable.
Know the failure story. Describe detection, fencing, promotion and routing, state the RPO and RTO, and mention rehearsals. Mention that dependencies (auth, payments, queues) must also survive the region loss.
Common follow-ups.
- "Two users in different regions edit the same thing?" Home it in one region. If it truly must be multi-writer, use a CRDT or field-level LWW, and say what is lost.
- "How do you stop overselling across regions?" Use one authority for that stock, or per-region quotas with rebalancing.
- "A user moves countries?" Run an automated relocation: copy, stream changes, a brief write freeze, flip the directory, delete the old copy.
- "Cost?" Cross-region transfer per GB, N/(N-1) spare capacity, and operations. Start single-region multi-AZ unless requirements demand more.
Deep Dive: Quorum placement and latency in multi-region consensusShow
Where the quorum lives decides latency. With Raft or Paxos across three regions, a write needs two of three replicas, so its latency is the round trip from the leader to the nearest other replica. Placing two replicas in one region and one far away makes writes fast (local quorum) but loses the quorum when that region fails. Five replicas across three regions (2-2-1) can survive a full region loss while keeping quorums reasonably close.
Leader placement. Putting range leaders (leaseholders) in the region where most writes for that range originate, which is what geo-partitioning does automatically, keeps most writes to one nearby round trip.
Stale reads as a tool. Spanner's bounded-staleness reads and CockroachDB's follower reads let any replica serve reads as of a few seconds ago without contacting the leader, which is ideal for dashboards and catalog pages.
Survival goals. CockroachDB lets you declare "survive zone failure" (replicas spread across zones in a region) or "survive region failure" (spread across regions, with higher write latency), making this trade-off an explicit setting.
Deep Dive: Why surviving a region costs a cross-region round trip, and the escape hatchesShow
The argument. Suppose a replicated database must keep accepting writes after losing any one region, and must never lose an acknowledged write. Then every acknowledged write must already be stored in at least one region other than the one that failed. In particular, it must be stored outside the region where it was accepted, or else losing that region loses it. So the acknowledgement must wait for at least one replica in another region: one round trip from the leader to its nearest other region is a lower bound on durable, region-survivable write latency. No protocol avoids this. Protocols can only choose which other region is nearest.
Placement arithmetic. Take three regions with approximate round-trip times US-East to US-West of 65 ms, US-East to EU of 80 ms, and US-West to EU of 140 ms. With one replica per region and a majority quorum of 2 of 3:
| Leader region | Quorum partner | Write latency for a client in leader region | For a client in EU |
|---|---|---|---|
| US-East | US-West (65 ms) | ~65 ms | ~80 + 65 = 145 ms |
| EU | US-East (80 ms) | ~80 ms | ~80 ms |
| US-West | US-East (65 ms) | ~65 ms | ~140 + 65 = 205 ms |
Moving the leader to where the writes come from is worth more than any protocol tweak. Geo-partitioning automates exactly that: each row's leader sits in its home region, and its quorum partner is the closest other region.
Escape hatch 1: accept a non-zero RPO. Asynchronous replication acknowledges locally (about 2 ms across AZs) and replicates afterwards. You trade a second or so of potential loss on a regional failure for local write latency. For most user data this is the right trade, which is why active-passive and LWW active-active are so common.
Escape hatch 2: survive AZs, not regions, for most data. Keep voters in three AZs of the home region, so writes need only a 1 to 2 ms quorum. Then replicate asynchronously to another region for DR. CockroachDB's SURVIVE ZONE FAILURE and Spanner's regional configurations are this choice.
Escape hatch 3: make the write not need ordering. If writes commute (CRDT counters, sets, append-only logs), each region can accept them locally and durability can be asynchronous or region-local, with merges later. Only data that needs ordering pays the round trip.
Escape hatch 4: reshape the quorums. Flexible Paxos (Howard, Malkhi and Spiegelman, 2016) showed that replication-phase quorums only need to intersect leader-election quorums, not each other. A system can use small, nearby write quorums, and large, slow quorums only when changing leaders. But if the write quorum lies entirely inside one region, losing that region still loses recent writes, so the lower bound above returns whenever region survival is required.
Reads are different. Consistent reads need no round trip at all if the reader knows it is up to date: Spanner's safe time, CockroachDB's non-voting replicas for GLOBAL tables, and leader leases all serve linearizable or snapshot reads locally. Their costs fall on writes (commit wait, future timestamps) or on lease handover. This asymmetry is the core of the PACELC trade-off for multi-region systems: during normal operation, you choose between latency and consistency, and good designs pick differently for reads and writes, and for each class of data.
Key Takeaways#
- Go multi-region for latency, disaster recovery or data residency, and be clear which one.
- Active-passive is simple but has remote write latency and failover data loss equal to lag; active-active is fast but creates conflicts.
- Geo-partitioning gives each record a home region: local writes, no conflicts, residency compliance.
- Spanner (TrueTime), CockroachDB and DynamoDB Global Tables make different consistency and latency choices.
- Avoid conflicts where you can, keep global invariants in one authority, and budget for transfer, capacity and operational cost.
- Durable, region-survivable writes cost at least one round trip to the nearest other region. Place leaders where writes originate.
- Classify every data type: home-region owned, global unique, commutative, reference, or derived.
- LWW converges but loses intent. Keep invariants in one authority, or split them with per-region quotas.
- Failover is detection, fencing, promotion and routing, plus warm-up. Rehearse it and measure real RPO and RTO.
- Residency covers every copy, including replicas, backups, logs, caches and exports.