System design · interactive
Clocks and ordering
Three servers exchange messages. Which events happened before which? Machine clocks drift, so their timestamps can contradict cause and effect. Logical clocks track causality instead of time.
Left to right is real time. Arrows are messages.
sorted by wall clock: f a g c b d e h
P3's clock runs 40 ms slow, so by wall time g (100 ms) happened before e (130 ms), even though g is receiving e's message. Timestamps from different machines can't order events.
Timestamps
Step 1 of 4 · read left to right
In production
Tools and technologies
Distributed databases choose a clock to order events.
Not tied to one language — use these names when you search docs or design a system.