QamoosTech
Architecture & DesignData and stateIntermediate

Logical Clock

PronunciationLOJ-ih-kul KLOK

Definition

A logical clock is a counter used to order events in a distributed system without trusting real clocks, which drift apart. A vector clock extends it to detect which events happened before others.

Where you hear it

In distributed systems courses, database internals (Dynamo, Cassandra) and conflict resolution talks.

Examples

  • Each message carries a Lamport timestamp so the receiver can order events.
  • Two vector clocks that can't be ordered mean a concurrent update, so a conflict.
  • Lamport timestamps show that the update on node B happened after the write on node A.

Common mistake

Comparing wall-clock timestamps across servers. A few seconds of drift can reorder events.

Don't confuse with

A wall clock (system time), which can jump or drift and is not safe for ordering across machines.

Say it at work

  • In a meeting or chatWe can't trust timestamps here; use a logical clock.
  • In an email or ticketDid A happen before B, or were they concurrent?