Skip to main content
cd ../lexicon
sys/docs/lexicon/interval-tree-clock-itc.md
Lexicon

Interval Tree Clock (ITC)

Difficulty: Advanced
3 min read

In plain English

Plain definition

A causality-tracking clock that lets an unbounded, dynamically changing set of distributed actors fork off portions of an identifier space, track events locally, and rejoin them later, without requiring a fixed, pre-known set of process identifiers like a vector clock does.

A vector clock requires every process in a system to hold a globally known, monotonically growing slot in a shared array. This works cleanly in systems with a small, stable, and known replica set, but breaks down when actors are created and destroyed dynamically — think autoscaling workers, ephemeral actors, or peer-to-peer swarms with high churn. ITC replaces the fixed identifier array with an id/event pair: the id component is a binary interval representing a slice of ownership over a conceptual [0,1] space, and the event component is a tree encoding logical increments scoped to sub-intervals of that ownership.

Three core operations define the algebra. fork splits an actor’s owned interval in half, handing one half to a new actor — no coordination with a naming authority is required because the interval itself acts as the identifier. event increments the local logical clock by growing the event tree within the actor’s owned interval, analogous to a vector clock tick but scoped structurally rather than by array index. join merges two stamps back together, reclaiming both the interval and event history, which is the mechanism that keeps the structure bounded even under continuous actor churn. Causal comparison (leq) walks both event trees to determine dominance, replacing the elementwise vector comparison used in classic vector clocks.

  • Compactness under churn: because retired actors reclaim their interval via join, the total encoded size stays proportional to the number of currently live actors, not the historical total — the failure mode of vector clocks in systems with high actor turnover.
  • No pre-registration: new actors are minted purely through fork, with no coordination service or identifier registry needed, which matters for P2P and serverless-style elastic topologies.
  • Garbage and fragmentation risk: if an actor crashes or is killed without executing join, its owned interval is permanently orphaned. Repeated failures to join fragment the interval space and cause the event tree to grow unboundedly, degrading comparison cost and defeating the compactness guarantee.
  • No total order: like vector clocks, ITC only establishes partial causal order; concurrent stamps still require an explicit merge or application-level conflict resolution, commonly paired with a CRDT or last-writer-wins policy.

In practice, ITC sees use in gossip-based replicated stores and actor frameworks where node identity is transient and coordination overhead for identifier assignment is unacceptable. The tradeoff against a vector clock is implementation complexity: encoding, serializing, and comparing interval/event trees is materially harder than array comparison, and tooling support is far sparser. Most production systems only reach for ITC when actor churn rate genuinely defeats vector clock assumptions; for a fixed replica set of moderate size, the simplicity and ubiquity of vector clocks outweighs ITC’s structural elegance.