Toolgeist › Developer

Vector Clock Visualizer — Real Causality, Real Lamport Comparison

A real vector clock implementation across three simulated nodes: local events and message sends increment a node's own component, receiving a message takes the elementwise maximum with the sender's vector, then increments — the standard algorithm. A real Lamport (scalar) timestamp runs on the exact same events in parallel, to make its actual limitation concrete: pick two genuinely unrelated events and the vector clock correctly reports them as concurrent, while Lamport's single number can make them look ordered when they never had any causal connection at all.

How to use Vector Clock Visualizer

  1. Trigger local events or start a message send from any node.
  2. Deliver an in-flight message to another node.
  3. Click any two events in the log to compare them.
  4. Look for a case where Lamport numbers look ordered but the vector clock says concurrent.

Frequently asked questions

What does "happens-before" actually mean here?
Event A happens-before event B when B's vector clock is greater than or equal to A's in every component and strictly greater in at least one — meaning every event A had knowledge of, B also had knowledge of, plus something more, established through a real chain of local events and messages.
Why can two events be "concurrent" even on a single physical timeline?
Concurrent here means causally unrelated, not simultaneous — two events with no message or local-event chain connecting them are concurrent in the vector-clock sense no matter what order a wall clock would have recorded them in.
Why does the Lamport timestamp fail to catch this?
A Lamport timestamp is a single number that only ever increases — it can guarantee that if A happens-before B then Lamport(A) < Lamport(B), but the reverse is not true: two concurrent events with no causal link can still end up with different, seemingly-ordered Lamport numbers purely by coincidence.
Where are vector clocks actually used?
Distributed databases (Riak, Voldemort historically used them for conflict detection during replication), version control systems, and any system needing to distinguish "definitely happened first" from "these two changes conflict and need reconciling".

Related Developer tools

Also searched for: vector clock simulator online · lamport timestamp vs vector clock · distributed systems causality demo

Browse all 738 free tools on Toolgeist →