Command Palette

Search for a command to run...

Hectal
PHASE 14Advanced ~8 min· topic 3 of 5

Topic 14.3

Multi-Region Redis

In one line

Across regions you must choose: one primary region with read replicas elsewhere (simple, stale remote reads, failover by promotion), independent per-region caches (fast, no cross-region consistency), or active-active with conflict-free replicated data types (Redis Enterprise/Cloud). Decide per data type, with explicit source of truth, latency, residency and DR goals.

0/5 · 0%

Think of it like this

A company with offices in India, the US and Europe. Each office keeps a local copy of the phone directory (read replicas or local caches), but only head office can change it (single primary). Some shared documents are edited everywhere at once, which needs rules for merging conflicting edits (active-active).

Key ideas

  1. 01

    Physics sets the rules: cross-region round trips are ~70–250 ms. Synchronous cross-region writes would make every write that slow, so multi-region Redis replication is asynchronous.

  2. 02

    Primary region + remote replicas: writes go to one region; other regions read locally (stale by replication lag, typically under a second). Examples: AWS ElastiCache Global Datastore (one primary region, secondary read-only regions, promotion on regional failure), cross-region replicas you manage yourself.

  3. 03

    Independent regional caches: each region caches from its own (or a global) database; invalidations fan out through a global event bus (Kafka with cross-region replication, or CDC per region). Simplest, and caches don't need cross-region consistency.

  4. 04

    Active-active: every region accepts writes; conflicts are resolved by CRDT rules (counters merge by summing, sets by add-wins, strings by last-writer-wins). Redis Enterprise and Redis Cloud offer this. Great for counters, sessions and leaderboards that must be writable everywhere; not for data needing single-writer invariants (inventory decrements that must never go below zero globally).

  5. 05

    Other decisions: data residency (EU user data may need to stay in the EU, so partition users by home region), failover (who decides to promote, and what's lost), disaster recovery (RPO/RTO per data type), and cost (cross-region data transfer is billed).

Code & diagrams

multi-region.mermaiddiagram
Rendering diagram…

Interview problem

The problem

Global Redis for India, the US and Europe

Your app serves users in India, the US and Europe. Redis holds sessions, a product cache, rate-limit counters and a global leaderboard. Design the multi-region Redis setup: source of truth, replication, latency, stale reads, conflicts, failover, data residency and DR.

The interviewer follows up

01

Why can't you just use one Redis Cluster spread across regions?

Explain it without notes

01

Compare primary-region replicas, independent regional caches, and active-active for multi-region Redis.

Practice

01

For your own system, list each Redis keyspace and pick a multi-region model and an RPO for it.

Trade-offs

  • ↔

    Local writes everywhere (active-active) vs simple consistency (single primary region) vs simplest operation (independent caches).

Done when you can

  • I can design multi-region Redis per data type with explicit source of truth, residency and failover.