Stage 2 · Lesson 6 of 10
Replication and read replicas
Replication keeps copies of the same data on several machines. That keeps data available when a machine fails and spreads out the reads. In , all writes go to one machine, the leader.
It streams its changes to followers, which serve reads. waits for a follower to confirm before telling the user the write worked. No data is lost if the leader fails, but writes are slower.
Asynchronous replication confirms straight away, which is faster, but a failover (switching to a follower) can lose the last few writes. Async followers fall behind, usually by milliseconds but sometimes by seconds. This is .
A user who posts and then reloads from a follower may not see their own post. Fix it with read-your-writes, for example by reading from the leader for a short time after a user writes.
Common trapadding to fix a write bottleneck: they only scale reads.
A question to check yourself, an AI practice session and 3 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Database Fundamentals for Tech Interviews
Design Gurus · Beginner · Subscription
Storage engines, indexes, transactions, isolation, replication, sharding and NoSQL models
- GitHub repoFreeSystem Design Interview Roadmap by karanpratapsingh
Karan Pratap Singh · Intermediate
Free: the databases, indexes, normalisation, ACID, sharding and replication chapters