← 🕰️ Distributed Systems

🕰️ Hybrid Logical Clocks Lab

Physical time:
Logical counter:
Drag — rotate · Scroll — zoom

🕰️ Hybrid Logical Clocks Lab

The simulation demonstrates how each node's Hybrid Logical Clock updates on local events and on receiving messages, showing the physical time component staying close to real wall-clock time while the logical counter increments only when needed to preserve causal ordering between events across nodes with independently drifting clocks.

🔬 What It Demonstrates

The simulation demonstrates how each node's Hybrid Logical Clock updates on local events and on receiving messages, showing the physical time component staying close to real wall-clock time while the logical counter increments only when needed to preserve causal ordering between events across nodes with independently drifting clocks.

🎮 How to Use

Add nodes with independently drifting physical clocks, trigger local events on any node to see its HLC advance, and send messages between nodes to watch the receiving node's HLC merge the maximum of its own prior timestamp, the incoming timestamp, and its current physical clock, with the logical counter incrementing exactly when physical time alone cannot resolve the order. Compare the resulting HLC pairs to confirm that causally related events always end up correctly ordered.

💡 Did You Know?

In most production traffic patterns, the logical counter portion of an HLC timestamp stays at zero or a very small number almost all the time, since it only needs to increment during bursts of causally related events that land within the same physical clock tick, which is why HLC timestamps look and behave almost exactly like ordinary timestamps in everyday use.