Curriculum · Module 02, Databases and Replication
Replication and lag
A leader copies every write to followers. When it waits for them decides how fast writes are, how stale reads get, and what a crash can lose.
What each topic covers
- A single database copy can crash, and a single machine can only answer so many reads. Copying the data fixes both and creates a new problem, which is that the copies disagree.
- When the leader acknowledges a write sets its speed and its risk. Session guarantees then keep one user's view sensible while followers lag.
- Switch between asynchronous, semi-synchronous and synchronous writes, stretch the delay, and fail the leader to count lost writes.
- Write latency, stale reads and lost writes for each acknowledgement rule, plus what the session guarantees cost.
- Statement, physical and row-level logs all keep followers in step, but they fail in different ways and cost different amounts of bandwidth.
- A follower applies the log more slowly than the leader writes it, and long queries on the follower can make it worse. The arithmetic of backlog and catch-up.
- Three quick checks on promoting a follower, a vanished comment and a pinned follower, plus the papers behind the lesson.
Topics
Practise this lesson
13 interview questions on replication and lag, with worked answers and sources.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms