Skip to content
← All concepts

Data & storage

Read replicas

Copy the primary database to extra servers that serve read queries.

Writes go to one primary; changes are streamed to replicas that answer reads. Since most traffic is reads, this multiplies capacity cheaply and gives a ready failover target.

See it in action

Step through the scenarios on the diagram.

Laying out diagram…

1/4A user updates their name; the write goes to the primary.

App servers
— Send writes to the primary, reads to replicas
Primary
— Accepts all writes
Replica 1
— Read-only copy
Replica 2
— Read-only copy

How it works

  • Asynchronous replication for scale (small lag), synchronous for zero data loss on failover.
  • Route reads that must see your own writes (e.g. right after posting) to the primary.

Trade-offs

  • Replication lag means replicas can return slightly old data.
  • Doesn't help write throughput — that needs sharding.

Seen in

Components involved

Related concepts