Ever imagined how Google is able to store and sync the immense amounts of data that is generated by its millions of users? The company makes use of atomic clocks collectively with Spanner database to sync the time between all data centers.
Spanner is a very ambitious project that holds together all the data Google has in its data centers. The idea behind Spanner is essentially to interconnect multiple data centers and synchronize them in a perfect manner so that data can flow between them seamlessly.
Time – the key problem
Given the sheer amount of data Google stores and handles, many had earlier remarked that such a project was almost impossible. The major problem in creating a Spanner-like software is the notion that when two users access data from two different parts of the world, they would view it differently due to varying time delays.
Thus, when Google engineers first set out to solve this problem, they knew that time was the critical factor in their venture. All they needed was to keep time absolutely consistent across all data centers, no matter how many thousands of miles they are apart, their problems would be resolved.
The task essentially required them to synchronize all the servers across all data centers and all the respective processes running on each of them. Normally, organizations rely on official atomic clocks maintained by external entities, to synchronize their servers. But these clocks are often unreliable.
Using atomic clocks and GPS
Google engineers came up with their own atomic clocks and GPS receivers to keep the time consistent between different data centers. With Spanner, a background software running on all machines on Google’s network keeps checking and synchronizing time with each other, time which in turn is maintained by Google-owned atomic clocks.
The system seems to be working perfectly for Google. Andrew Fikes, a notable software engineer at the search giant, says, “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. 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.”
By working out the key problem of time delays, Google has been able to turn its data centers, situated in different parts of the world, into one single global entity which is wholly consistent. And such an achievement is certainly going to profit the company immensely in the coming days, as the amounts of web-generated data grows exponentially.