Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. One copy is not enough
  2. 2. Three ways to say yes
  3. 3. Slow the network and kill the leader
  4. 4. When a leader crash loses acknowledged writes
  5. 5. What the replication log actually contains
  6. 6. How a follower falls hours behind
  7. 7. Check the failover and lag cases

Topic 3

Slow the network and kill the leader

8 min read

Compare the rules

The lab runs a leader and up to six followers on a network with a variable delay. Pick Compare all replication modes and all three rules run side by side on the same writes and the same network delays. Each panel shows lag per follower, mean write latency, the share of stale reads and, after you press the fail button, how many acknowledged writes were lost.

Predict before you press the button

You raise the network delay from 20 ms to 150 ms. What happens to write latency under asynchronous replication, and under synchronous?

lag = now − time of the oldest write a follower lacks3 followers, one-way delay 20 msleader acknowledges after: depends on the mode

The most up-to-date follower takes over. Writes it never received are gone.

Asynchronous

write latency
1.0ms
p99 write
1.0ms
stale reads
55.1%
acked writes lost
0

Semi-synchronous

write latency
37.8ms
p99 write
56.3ms
stale reads
2.2%
acked writes lost
0

Synchronous

write latency
57.5ms
p99 write
80.2ms
stale reads
0.0%
acked writes lost
0
Mean follower lag
Mean follower lag. Text version available below the chart.0.012.525.037.550.0t=0.0st=0.6st=1.2ssimulated timelag (ms)
Stale reads, last 0.5 s
Stale reads, last 0.5 s. Text version available below the chart.0%25%50%75%100%t=0.0st=0.6st=1.2ssimulated timeshare of reads

Reads under: Any follower, at random

stale reads
55.1%
own write missing
6.5%
went back in time
0.5%
served by leader
0%

Stale means older than the newest acknowledged write. Own write missing means a client did not see a write it had been told succeeded. Went back in time means a client saw an older value than one it read before. Numbers shown are for the first mode, asynchronous.

Full-page version with guided experiments: Replication and lag lab.

Things to try

  1. Compare all modes. Which has the lowest write latency, and which has the most stale reads?
  2. Raise the write rate to 100 and press Fail the leader now. Which modes lost acknowledged writes?
  3. Switch to asynchronous only and raise the delay to 150 ms. Watch the lag bars and the stale read share.
  4. Set where reads go to a random follower, then to the option that falls back to the leader when behind your last write. Watch “own write missing”.
  5. Compare a random follower with one fixed follower per client and read “went back in time”.

The full-page lab has five guided experiments with a setup button for each.

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