Skip to content

Read Replicas ​

Additional copies of your database that handle read traffic only — writes still go to master.

Why Read Replicas Exist ​

Typical web application: 80-90% reads, 10-20% writes. Without read replicas all reads hammer the master. With read replicas, reads spread across replicas and master focuses on writes.

Replication Lag — The Main Problem ​

User writes a post → goes to Master. User immediately reads their feed → goes to Replica → Replica hasn't synced yet → User doesn't see their own post.

Solutions ​

  • Read your own writes from Master — after any write, route that user's next read to master for a short window
  • Sticky sessions — same user always reads from same replica
  • Application-level tolerance — social feeds: lag is fine; bank balance: must read from master

Read From Master vs Replica ​

Read from MASTERRead from REPLICA
Immediately after a write (your own writes)Social media feeds
Financial data (balance, transactions)Product listings
Inventory counts (don't oversell)Analytics dashboards
Anything where stale = dangerousReports and aggregations

Read Replicas vs Caching ​

Read ReplicasCaching (Redis)
Data coverageFull database copyOnly explicitly cached data
Query supportAny SQL querySimple key lookups
FreshnessRelatively freshCan be stale longer
SpeedFastMuch faster (in-memory)
Best forComplex queriesFrequent identical queries

Real systems use BOTH: Cache hit → Redis. Cache miss → Read replica. Write → Master.

Cloud Read Replicas ​

PlatformFeatures
AWS RDSUp to 5 read replicas per instance, one click to create
AWS AuroraUp to 15 read replicas, shared storage (no replication lag!)
Google Cloud SQLRead replicas across regions
Azure SQLUp to 4 readable secondaries (active geo-replication)