Distributed Systems Lab

Distributed Systems Lab

Eleven ideas that only matter once you have more than one machine.

Event Ordering

Wall clocks lie. Causality doesn't.

Node B's clock is 6ms behind Node A's. By wall-clock time, the thumbnail job looks like it happened before the upload that caused it. Logical ordering knows better.

A

User uploads a profile photo

wall clock: 14:03:00.412logical: A:1
B

Thumbnail worker picks it up

wall clock: 14:03:00.408logical: A:1 → B:1
A

User sets it as their avatar

wall clock: 14:03:00.415logical: A:2
Sorting these three events by wall clock puts the thumbnail job first — physically impossible, since it depends on the upload. Sorting by logical clock (or a vector clock, or Kafka offsets) preserves the true cause-and-effect order regardless of clock skew.