Choosing a Clock for Local Durations and Distributed Events

Elapsed-time measurements and event timestamps have different requirements. Clocks on different hosts may disagree.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace send and receive timestamps
  2. Measure durations locally when possible
  3. Distinguish elapsed measurements from order across hosts
  4. Use ordering evidence relevant to your question

Trace send and receive timestamps

A received message can appear to have an earlier wall-clock stamp than its send event due to clock differences. Message order still relates those observations. See Lamport clock order.

Measure durations locally when possible

Use an appropriate elapsed-time clock within the process for time budgets. Important cross-host ordering can use protocol evidence. Timestamp and duration storage describe their separate meanings.[1]

Distinguish elapsed measurements from order across hosts

A host can measure its own request duration with a monotonic clock. Timestamps from two hosts can disagree because their wall clocks differ. A reply's wall-clock timestamp can look earlier than the initiating request even when causal order is known. See timestamps and durations.

Host A starts request → host B processes → A receives reply
Causal order follows message events
A's elapsed measurement uses one local clock

Use ordering evidence relevant to your question

A shared sequence or explicit parent event can preserve causal or per-record order. Normalize timestamps for display while keeping their uncertainty in mind. Test traces with a deliberate clock offset.

References

  1. Google, Site Reliability Engineering ↩