Follow Datanami:
November 27, 2012

Behold, Google’s Time Lord

Ian Armas Foster

Maintaining temporal consistency across a worldwide network is a surprisingly difficult yet important task. Databases need to decide the correct order in which transactions across the world took place, a process made complicated by the amount of time it takes for satellites and data centers to receive the proper time from each other.

Enter Spanner, Google’s system designed by engineers Andrew Fikes, Wilson Hsieh, Jeff Dean, and Sanjay Ghemawat which essentially standardizes time across its various satellites and data centers.

In order to maintain a consistent time stamp, Google eschewed the typical Network Time Protocol for their own TrueTime API. In essence, TrueTime API allows devices across the global Google network to keep the same time by running a daemon that constantly check with master servers. “We wanted something that we were confident in,” said Fikes. “It’s a time reference that’s owned by Google.”

Usually, a major problem with an approach like this is that it takes a significant amount of time to send information among master servers and data centers and satellites. Instead of focusing on that communication, Google ended up giving each device its own way of telling time such that the checks to the master server require less information transfer.

The technique impressed competitors at Facebook, with their Raghu Murty noting “That was probably the coolest thing about the paper: using atomic clocks and GPS to provide a time API.”

The idea is to record every transaction that happens across the vast Google network definitively when they happened. “We can commit data at two different locations — say the West Coast [of the United States] and Europe — and still have some agreed upon ordering between them,” said Fikes, “So, if the West Coast write happens first and then the one in Europe happens, the whole system knows that — and there’s no possibility of them being viewed in a different order.”

Further, the system allows Google to deal with time anomalies, like when a leap second was added to the timeline in July. A few big organizations such as Mozilla, Reddit, and Gawker were ill-prepared to handle the additional second. Google’s process of keeping atomic time on its devices coupled with communicating with its master servers alleviates that issue.

Datanami