Replication, Read Replicas, and Failover

Replication copies data to multiple nodes for availability, read scaling, and disaster recovery. Synchronous replication waits for a defined acknowledgment condition before confirming a write; asynchronous replication acknowledges earlier but can lose recent acknowledged writes during some failovers.

A read replica can reduce load on a primary, but replica lag means a read immediately after a write may return old data. Route correctness-sensitive reads to the primary or use a mechanism that waits for a replica to reach a required version.

Failover includes detection, promotion, routing changes, and client reconnection. Detection that is too slow extends downtime; detection that is too aggressive risks unnecessary failover or split-brain. Test the entire recovery path and measure recovery time and possible data loss rather than relying on a diagram.

Key Takeaways
  • Replication improves resilience but introduces lag and operational complexity.
  • Failover behavior determines actual recovery outcomes.
  • Measure RTO and RPO in tested recovery exercises.