Ordering the Chaos: Cleaning Logs and Ordering Events in Microservices
summary
Physical timestamps break across datacenters and DST; relying on NTP or UTC alone produces out-of-order reads and leap-second havoc, so the recommendation is to use logical clocks to order single workflows. Implement Lamport timestamps plus a stable correlation id propagated in two headers; receivers take max(local,received)+1 and logs are sorted by that counter (shown working in CloudWatch). For stronger cross-node causality use vector clocks (correct but network-heavy); TrueTime needs local atomic clocks and is expensive.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:32What is time in systems
- 5:05Wall clock limitations
- 12:30Time zones and DST issues
- 28:22Clock synchronization algorithms
- 32:12Logical clocks vs physical clocks
- 34:23Lamport timestamps explained
- 41:09Implementing logical timestamps
- 47:54Propagating correlation IDs
- 51:06Ordering and cleaning logs
- 53:33Vector clocks and consensus
- 58:09Summary and takeaways
