Clock Skew and Clock Drift
You'll learn why clocks in distributed systems gradually diverge and what causes this inevitable drift.
The Problem: No Two Clocks Stay in Sync
In distributed systems, every machine has its own physical clock—a quartz oscillator that counts time. The harsh reality? These clocks never stay perfectly synchronized. Even if you set two clocks to the exact same time right now, they'll show different times moments later. This divergence happens in two forms: clock skew and clock drift.
Clock Skew: The Initial Offset
Clock skew is the instantaneous difference between two clocks at any given moment. If Server A reads 12:00:00.000 and Server B reads 12:00:00.150 at the "same" instant, they have a 150-millisecond skew.
Think of it like two runners starting a race: even if they try to start together, one might be a fraction of a second ahead—that's the skew.
Clock Drift: The Rate of Divergence
Clock drift is how fast that difference changes over time. All physical clocks run at slightly different rates due to:
- Manufacturing variations: No two quartz crystals oscillate identically
- Temperature: Heat makes crystals vibrate faster or slower
- Age: Components degrade over time
- Voltage fluctuations: Power supply variations affect timing
A typical computer clock might drift 50 parts per million (PPM), meaning it gains or loses up to 50 microseconds per second—about 4.3 seconds per day!
Two servers with identical initial time but different drift rates will show increasingly different times as hours pass.
Key Takeaway: Clock skew is the current time difference between systems, while clock drift is the rate at which clocks diverge due to hardware imperfections and environmental factors—making synchronized physical time in distributed systems fundamentally unreliable.