How do Read Replicas help scale a relational database? What is 'Replication Lag,' and how does it affect application consistency?
Last updated
Read replicas are read-only copies of the primary that spread read traffic across nodes. All writes still go to the single primary, so they scale reads, not writes.
Replication lag is the delay (milliseconds to seconds) before a primary's committed write appears on a replica. It makes replicas eventually consistent, so a user may not see their own just-written change (read-your-writes problem).
Mitigate by routing freshness-critical reads to the primary and tolerant reads to replicas. Synchronous replication removes lag at the cost of higher write latency.
- https://www.mironsoft.de/en/blog/sql-read-replicas-the-right-way
- https://hykell.com/knowledge-base/aws-rds-read-replica-performance/
- https://repost.aws/knowledge-center/rds-mysql-high-replica-lag
- https://vizlearn.in/database/replication_and_lag.html
- https://www.netdata.cloud/guides/postgres/postgres-replication-lag/
- https://medium.com/@rahul.jindal57/system-design-interview-replication-part-3-replication-lag-and-read-consistency-7913a818bd31
- https://hafiqiqmal93.medium.com/the-backend-engineers-guide-to-postgresql-replication-lag-e75598069dac
- https://medium.com/@pratheekshetty/how-databases-scale-a-practical-roadmap-from-one-server-to-sharding-8fb2eb3672dd