cloudpatterns.appClassroomKatasWhiteboardBlog
Z3 · Data & Storage

Read replicas

Read replicas

Gold

Read replicas are copies of the database that serve reads, so a read-heavy app can add read capacity while every write still goes to one primary.

Use when
Read-heavy workloads with a modest write rate
Avoid when
Write-heavy load — every write still lands on the primary · Reads that must see the write that just happened
Trade-offs
Replication lag vs freshness — a replica can return an older answer than the primary · Read capacity only — writes still all land on the primary
Requires
Split app and database tiers, Load balancer
3 objectives · 5 misconceptions
  • predict Predict the load on the primary and on each replica when reads are spread across N replicas.
  • explain Explain replication lag and when a read from a replica can return stale data.
  • choose Choose which reads may go to a replica and which must go to the primary.
  • Not true: Read replicas add write capacity too.
  • Not true: A write shows up on every replica immediately.
  • Not true: Any query can safely go to any replica.
  • Not true: A replica is a backup.
  • Not true: Adding replicas puts no extra work on the primary.

Neighborhood

contrast withCache-asideSharding
On linesData LineScale Line

Progress is saved on this device