Skip to content
hashkey.bond

Archivedistributed-systems

Vector Clocks Detect Concurrency, They Do Not Resolve It

A vector clock tells you whether two events are ordered or concurrent. The application still has to choose.

Published
Reading time
1 min read

A vector clock is a map from node ID to counter. On a local event, increment your own entry; on receive, take the element-wise max and increment. Comparing two clocks tells you before, after, or concurrent.

What it buys

  • Causal ordering without synchronized clocks.
  • Detection of true concurrency, which Lamport clocks cannot distinguish from arbitrary interleaving.
  • Conflict detection in multi-master stores (Dynamo's context).

What it costs

  • Size grows with the number of writers, not the number of events. Pruning requires knowing which writers are inactive.
  • It does not merge anything. The application must resolve concurrent versions — last-writer-wins, merge, or ask the user.
  • Dotted version vectors exist because plain vectors over-count in some replication protocols.

Takeaway: vector clocks are a detector. Pair them with an explicit merge policy, or you have built an expensive way to notice conflicts you still cannot resolve.