Skip to content

Multi-Region Databases: Active-Active Architecture

CoreConceptAugust 3, 20269 min read

Single-region database deployments create single points of failure (SPOFs). If an entire cloud availability zone or geographic region experiences a fiber cut, power outage, or catastrophic infrastructure failure, global applications go offline. Routing global users (e.g., in Tokyo or London) across oceans to a primary database in US-East introduces 150ms+ cross-continental network latency on every database write.

Multi-Region Active-Active Database Architecture deploys fully read-write database clusters concurrently across multiple geographical regions. Users execute reads and writes locally with sub-10ms latency while background synchronization channels replicate mutations across continents. This guide details active-active topology, Conflict-Free Replicated Data Types (CRDTs), Google Spanner TrueTime hardware synchronization, and CockroachDB distributed Raft consensus.

Multi-region active-active database topology with CRDT conflict resolution, TrueTime, and Raft consensus
Multi-region active-active database topology with CRDT conflict resolution, TrueTime, and Raft consensus

Mental Model: Active-Passive Replication vs Multi-Region Active-Active

Traditional Active-Passive database configurations route 100% of write operations to a single primary database node in Region A. Secondary nodes in Region B and C receive read-only replication streams.

While Active-Passive provides failover capabilities, cross-continental write latency remains constrained by physical speed-of-light limits (~70ms RTT from New York to London).

Active-Active Topology allows nodes in every region to accept write operations simultaneously. However, concurrent writes to the same database row across multiple regions introduce data divergence and update conflicts. Resolving these write conflicts requires specialized consensus algorithms and distributed data structures. For consensus fundamentals, review deep dive raft consensus algorithm and when to use redis redlock vs etcd vs zookeeper.

Multi-region active-active transaction sequence from local write execution to Raft consensus quorum commit
Multi-region active-active transaction sequence from local write execution to Raft consensus quorum commit

Quick reference

  • Active-Passive routes writes to a single primary region, creating high cross-continental latency.
  • Active-Active allows every geographic region to accept local reads and writes concurrently.
  • Delivers sub-10ms local write response times by eliminating cross-ocean network hops.
  • Requires conflict resolution engines (CRDTs, Hybrid Logical Clocks) to merge divergent writes.
  • Survives complete regional cloud outages without human intervention or data loss.

Remember this

Deploy active-active database clusters to accept local writes across regions and eliminate cross-ocean RTT latency.

Conflict-Free Replicated Data Types (CRDTs) & Last-Write-Wins (LWW) Resolution

When two users concurrently update the same user profile in US-East and EU-West, the database must resolve the conflicting mutations deterministicly without locking.

Common conflict resolution strategies include: 1. Last-Write-Wins (LWW): Uses wall-clock timestamps to accept the latest write. However, clock skew between regional servers can cause silent data loss (overwriting newer data with older data). 2. State-based CRDTs (Pn-Counters, LWW-Element-Set): Data structures mathematically designed to merge concurrent operations without ordering constraints (merge(A, B) == merge(B, A)).

Modern active-active engines (like AWS DynamoDB Global Tables or YugabyteDB) use Hybrid Logical Clocks (HLC) combining physical NTP clocks with logical sequence counters to prevent clock skew data loss.

Quick reference

  • Last-Write-Wins (LWW) relies on timestamps but risks data loss due to server clock skew.
  • CRDTs mathematically guarantee that concurrent operations merge to identical final states across nodes.
  • Hybrid Logical Clocks (HLC) combine physical NTP time with logical counters to prevent clock drift issues.
  • Column-level conflict resolution merges non-overlapping attribute updates safely.
  • Application-level custom merge rules handle complex domain entity conflicts (e.g., inventory deduction).

Remember this

Use CRDTs and Hybrid Logical Clocks to resolve concurrent multi-region write conflicts deterministically.

Google Spanner TrueTime API & CockroachDB Distributed Raft Consensus

Enterprise active-active systems use specialized distributed consensus primitives to provide strict external consistency (serializability) across regions.

Google Cloud Spanner utilizes the TrueTime API, which relies on atomic clocks and GPS receivers installed in Google datacenters to bound clock uncertainty to $\epsilon < 1\text{ms}$. This enables globally distributed serializable transactions without cross-region locks.

CockroachDB splits tables into 64MB key-value Ranges, assigning each Range a 3-node or 5-node Raft Consensus Group distributed across availability zones and regions. Writes execute Raft consensus across a majority quorum (2 of 3 nodes) before committing.

Multi-region active-active transaction sequence from local write execution to Raft consensus quorum commit
Multi-region active-active transaction sequence from local write execution to Raft consensus quorum commit

Quick reference

  • Google Spanner TrueTime uses hardware atomic clocks to bound global clock uncertainty to sub-millisecond ranges.
  • TrueTime enables globally consistent serializable transactions across multi-region clusters.
  • CockroachDB uses Raft Consensus Groups per 64MB Range to coordinate distributed commits.
  • Raft majority quorums allow commits to complete as soon as the fastest regional replicas acknowledge.
  • Geo-partitioning pin rows to specific regional Range groups to keep write quorums geographically local.

Remember this

Use Spanner TrueTime or CockroachDB Raft Range groups to achieve globally serializable transactions.

Global Traffic Routing, Geo-DNS, & Read-Local Write-Global Latency SLAs

Routing client requests to the optimal multi-region database cluster requires combining Geo-DNS and Anycast IP routing (such as AWS Route53 Latency Routing or Cloudflare Anycast).

Anycast BGP routes client TCP connections to the nearest edge PoP, minimizing WAN network distance.

To balance latency and consistency, applications adopt a Read-Local Write-Global pattern: read queries hit local in-memory read replicas immediately, while critical financial transactions execute synchronous Raft consensus across regional quorums, guaranteeing 99.999% SLA availability.

Quick reference

  • Geo-DNS and Anycast BGP route client HTTP requests to the physically nearest regional edge location.
  • Read-Local caching serves 95%+ of user queries directly from in-region database read replicas.
  • Synchronous multi-region quorums guarantee zero data loss (RPO = 0) during regional cloud outages.
  • Automated health probes fail over traffic to adjacent regions in sub-5 seconds if a region collapses.
  • Reduces global application tail latencies (P99) from 250ms+ down to sub-15ms.

Remember this

Combine Anycast Geo-DNS routing with read-local replicas to achieve sub-15ms global P99 latencies.

Key takeaway

To test multi-region databases, spin up a local 3-node CockroachDB cluster using Docker Compose (cockroach start-single-node). Experiment with table locality and observe quorum replication.

Share:

Related Articles

As relational databases grow beyond millions to billions of rows, single-table query performance degrades due to massive

Read

Relational databases like PostgreSQL excel at Online Transaction Processing (OLTP)—handling frequent single-row reads, u

Read

At the heart of every database system lies a Storage Engine that determines how data is written to disk, indexed, and re

Read

Keep learning

Follow a structured path or browse all courses to go deeper.