Skip to content
Preptima
hardConceptSeniorStaffLead

Two servers each write a record stamped with its own clock. Why can you not use those timestamps to decide which write happened first, and what do you use instead?

7 min readUpdated 2026-08-15

Answer

Short answer

Wall clocks on separate machines disagree by an unbounded amount and can jump backwards, so their timestamps order events by accident rather than by causality. Logical and vector clocks capture what preceded what, quorums give overlap not order, and a lease is safe only with a fencing token.

Logical clocks are useful because they record causal order without pretending there is one global time. Good logical clocks reasoning explains when Lamport clocks are enough and when vector clocks are needed. Weak logical clocks answers sort timestamps and miss concurrent events.

Logical clocks give the system a way to reason about before and after without inventing perfect time.

Was this answer helpful?

Likely follow-ups

  • Your store resolves conflicts by keeping the write with the higher timestamp. What is the failure you have accepted?
  • Vector clocks grow with the number of writers. How would you bound that in practice?
  • Under what conditions can you legitimately order events by physical time?
  • How does a follower know the leader it is talking to is still the leader?

Related questions

Masterclass guide

Further reading

Related Topics