When to use read replicas
Topic: Databases core
Summary
Use read replicas when read load exceeds primary capacity or you need geographic distribution. Replicas add lag and eventual consistency. Use this when deciding whether to add replication for scaling or HA.
Intent: Decision
Quick answer
- Use replicas when read volume is high and primary is CPU or I/O bound. Route read-only queries to replicas; keep writes on primary.
- Accept replication lag and eventual consistency. Some reads may need primary for strong consistency; design app for that.
- Replicas add ops and failover complexity. Prefer connection pooling and query optimization first; add replicas when metrics justify.
Prerequisites
Steps
-
Assess load
Measure read vs write ratio and primary CPU/I/O. If reads dominate and primary is saturated, replicas can help.
-
Consistency requirements
Identify which reads need strong consistency; route those to primary. Route everything else to replicas with lag monitoring.
-
Plan failover
Document promotion and app reconfiguration. Test failover; use connection pooling or proxy for replica routing.
Summary
Use read replicas when read load justifies them; accept lag and plan consistency and failover.
Prerequisites
Steps
Step 1: Assess load
Measure read/write and primary utilization; decide if replicas are needed.
Step 2: Consistency requirements
Route strongly consistent reads to primary; others to replicas with lag checks.
Step 3: Plan failover
Document promotion; test; use pool or proxy for routing.
Verification
- Read traffic split; lag within SLA; failover tested.
Troubleshooting
High lag — Check replica I/O and network; reduce load or add replicas. Stale reads — Route critical reads to primary.