Cianplan

Level 3: Distributed systems · L3.1 Time, clocks, consensus & leader election

Locks, leases and fencing tokens

Use leases with fencing tokens and know when a Redis lock is unsafe.

12 min · Pro

What you take away

  • A distributed lock is a lease, and the holder can be paused past its expiry without noticing.

And 3 more inside the class, in Pro.

How the class is laid out

  1. The problem
  2. The simple version
  3. The two reasons to take a lock
  4. Fencing makes it safe
  5. When the resource cannot check
  6. Clocks lie
  7. Logical clocks
  8. Consensus
  9. Raft
  10. Locks
  11. Check your understanding