Geo-replication

On this page 7

Geo-replication is the practice of copying database data to servers in geographically separate regions, typically hundreds or thousands of kilometers apart, so that the system survives the loss of an entire data center or cloud region and serves users from a nearby copy. In database replication, it extends the familiar primary-replica model across wide-area networks, where the speed of light, not disk or CPU, becomes the dominant constraint.

Geo-replication is the foundation of disaster recovery across regions, global read scaling and data residency strategies in modern databases. Its central design question is how much write latency an organization will accept in exchange for a guarantee that no committed data is lost when a region fails.

How geo-replication moves data between regions

Geo-replication works by shipping a stream of changes from the region that accepts a write to one or more remote regions, where each change is applied in the same order. The stream is usually the database’s own write-ahead log or binary log, sent through streaming replication, or a row-level change feed produced by logical replication. Storage-level systems replicate disk blocks instead, which is simpler but couples both sites to the same engine version.

The defining property is network distance. A round trip between nearby availability zones takes roughly 1 to 2 milliseconds, while a round trip between continents takes about 70 to 250 milliseconds. Every protocol that waits for a remote acknowledgment pays that cost on each commit, so the choice between synchronous and asynchronous replication matters far more across regions than inside a single data center.

The table below shows typical round-trip times and how they affect commit latency when a write must wait for a remote copy.

TopologyTypical round tripEffect on synchronous commit
Same availability zoneUnder 1 msNegligible
Zones in one region1-2 msSmall, usually acceptable
Regions on one continent10-40 msNoticeable for chatty workloads
Intercontinental regions70-250 msOften prohibitive for every commit
Typical network distance and its effect on synchronous commits

Geo-replication topologies and consistency modes

Geo-replication deployments fall into a few recurring topologies, each with a different answer to where writes are accepted. The simplest is active-passive, where one primary region takes all writes and remote regions hold read replicas or standby copies. More ambitious designs accept writes in several regions through multi-primary replication or a consensus protocol such as Raft spanning three or more regions.

TopologyWhere writes goMain strengthMain weakness
Active-passive asynchronousOne primary regionFast local commitsPossible data loss on failover
Active-passive synchronousOne primary regionZero data lossEvery commit pays remote latency
Multi-primarySeveral regionsLocal writes everywhereWrite conflicts must be resolved
Consensus across regionsLeader elected by quorumAutomatic, consistent failoverCommit needs a majority of regions
Common geo-replication topologies

In asynchronous geo-replication, the remote copy trails the primary by a replication lag that ranges from milliseconds under light load to minutes during write bursts or network trouble. That lag defines the recovery point objective (RPO): transactions committed but not yet shipped are lost if the primary region disappears. Semi-synchronous replication narrows the window by requiring one replica, often in a nearby region, to confirm receipt before the commit returns.

Multi-primary designs avoid the latency penalty but introduce write conflicts when two regions modify the same row concurrently. Systems resolve them with rules such as last-writer-wins timestamps, application-defined merge logic or conflict-free replicated data types, and each choice can silently discard an update unless the data model is designed for it.

Geo-replication is a deployment pattern, not a separate protocol: it reuses the replication mechanisms of the database but applies them across regions. The comparison below separates it from neighboring concepts that are often confused with it.

ConceptPrimary goalTypical distanceRelation to geo-replication
Local high availabilitySurvive a server failureSame regionUsually combined with it
Read replicaOffload read queriesAnyRemote read replicas are one form
Backup and restoreRecover from corruption or deletionAnyStill required; replication copies mistakes
Delayed replicaUndo recent bad changesAnyCan be placed in a remote region
ShardingSplit data for scaleAnyCan pin shards to home regions
Geo-replication and neighboring concepts

A crucial distinction is that geo-replication is not a backup. An accidental DROP TABLE or a faulty migration replicates to every region within seconds, so point-in-time backups or a delayed replica remain necessary for recovering from logical errors.

Designing a geo-replicated database

Designing geo-replication starts from two business targets: the recovery point objective, which limits acceptable data loss, and the recovery time objective (RTO), which limits how long the service may be unavailable. These targets, together with where users and regulators are located, determine the topology.

RequirementRecommended approachReason
RPO of minutes, low costAsynchronous standby regionNo commit latency penalty
RPO of zero, one continentSynchronous or quorum across nearby regionsRound trips stay in tens of milliseconds
Global users reading heavilyRemote read replicas near usersReads served locally
Writes from every continentMulti-primary with conflict-free data modelAvoids intercontinental commit latency
Data residency rulesPer-region partitions with selective replicationRegulated data stays in its jurisdiction
Choosing a geo-replication strategy

Operational details decide whether the design works in a real incident. Teams should monitor lag continuously, size network links for peak change volume, and rehearse regional failover on a schedule. Applications reading from remote replicas need explicit rules for read-your-writes consistency, for example routing a user’s reads to the primary for a few seconds after that user writes.

Failure modes and common mistakes in geo-replication

The most dangerous failure in geo-replication is split-brain, where a network partition between regions leads both sides to believe they are the primary and accept conflicting writes. Consensus systems prevent it by requiring a quorum of regions, which is why three regions, or two regions plus a lightweight witness, are the usual minimum for automatic failover.

  • Assuming zero data loss with asynchronous replication, when the lag at failure time is the real exposure.
  • Failing over without fencing the old primary, so it keeps accepting writes after recovery.
  • Ignoring failback: returning to the original region requires resynchronization, which can take hours for large datasets.
  • Underestimating egress costs, since cloud providers charge for data transferred between regions.
  • Testing only planned switchovers, which hide problems that appear in abrupt, unplanned regional outages.

The simple explanation

Geo-replication means keeping copies of the same database in different parts of the world. If a fire, flood or power failure takes out one location, another location already has the data and can take over.

The catch is distance. Waiting for a faraway copy to confirm every change makes the system slower, while not waiting means the newest changes might be lost in a disaster. Every geo-replicated system chooses a balance between speed and safety.

How it is used in practice

An online retailer runs its order database in a primary region in Western Europe, with an asynchronous standby in a second European region about 1,000 kilometers away and read replicas in North America and Asia. Normal replication lag stays under one second, and product catalog reads from customers abroad are served by the nearest replica in under 20 milliseconds.

When a power failure takes the primary region offline, the operations team promotes the European standby after confirming the old primary is fenced. The service returns in about twelve minutes, and fewer than one second of orders must be reconciled from payment provider records, which is within the agreed recovery point objective.