Replication: Read Replicas and Failover
On this page
Replication Improves Availability and Read Capacity
Replication copies data from a primary database to one or more replicas. This allows read traffic to be distributed and provides redundancy in case the primary fails.
Replication Lag
Replication is not instantaneous. Under load, replicas may fall behind. This creates eventual consistency behavior for read-after-write scenarios.
Failover Behavior
When the primary fails, a replica can be promoted. However, failover is not free: clients must reconnect, in-flight transactions may fail, and temporary downtime may occur.
Read Strategies
- All reads from primary (strong consistency, limited scale)
- Read-heavy endpoints from replicas (better throughput, possible staleness)
- Read-after-write from primary only
Operational Concerns
- Monitoring replication lag
- Testing failover regularly
- Ensuring backups align with replication topology
Production-First Takeaway
Replication increases availability and read throughput but introduces lag. Design read paths with explicit consistency expectations and monitor lag continuously.