Skip to main content

Clock Synchronization, Leader Election and Split-Brain Problems

Learn Clock Synchronization, Leader Election and Split-Brain Problems (Phase 9 · Distributed Systems (Core), Microservices) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Clocks in distributed systems • Machine clocks drift and differ (NTP keeps them within milliseconds, but can jump). So wall-clock timestamps cannot reliably order events across machines, and "the latest timestamp wins" can silently lose data. • Tools: logical clocks ( Lamport timestamps : a counter that gives a consistent order consistent with causality), vector clocks (detect concurrent/conflicting updates), hybrid logical clocks (HLC: physical time + logical counter, used by CockroachDB), TrueTime (Spanner: bounded clock uncertainty), per-aggregate version numbers , DB sequences, monotonic...

More lessons in Phase 9 · Distributed Systems (Core)