Try
↑ ↓ move↵ openesc close

Curriculum · Module 02, Databases and Replication

Lesson 1 · 7 topics · 39 min · Beginner · 0/7 done

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

  1. 1One copy is not enough4 min
  2. 2Three ways to say yes6 min
  3. 3Slow the network and kill the leader8 min
  4. 4When a leader crash loses acknowledged writes6 min
  5. 5What the replication log actually contains6 min
  6. 6How a follower falls hours behind6 min
  7. 7Check the failover and lag cases3 min

Practise this lesson

13 interview questions on replication and lag, with worked answers and sources.

Practise these

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms