How Google Warps Time to Keep Its Computers Running

15 Sep

weirdclock150.pngIt would be nice if time just marched along in an orderly fashion, one second after another, each of equal length, 31,556,926 times per year, but that's not the way the world works. Years are actually a bit shorter than we pretend they are, so we invented little tricks - algorithms, if you will - to compensate. The Gregorian calendar adds an extra day to its shortest month every four years to adjust for the discrepancy. My native tribe, however, also uses a lunisolar calendar, which we fix by adding a whole extra month seven times every 19 years.

Simple enough, right? Well, actually, the Earth is still too wobbly for these simple equations, so we lose and gain a few milliseconds here and there. Atomic clocks occasionally have to use a leap second to keep things lined up with astronomical time. Doesn't matter much to us, right? But imagine you're not just trying to keep your appointments straight. Imagine you're trying to keep all of Google's computers from crashing. Then what do you do?



If you're Google, you can't just repeat a second at the end of the day whenever the IERS announces a leap second, because you're running too many time-sensitive operations. What happens if two delicate processes happen one second after another, but the computer thinks they took place at the same time? Kablooey, right? Well, believe it or not, Google has solved the problem.

The Google Site Reliability Team just published a fascinating and in-depth post explaining how they solved the leap second problem. They call it a "leap smear." It involves gradually "lying" to the computers by a few milliseconds over the course of the whole day. After a leap second hiccup in 2005, when some Google systems stopped accepting work, the team devised this solution.

Check out the post on the Google Blog.

Photo 1 credit: Cornell University Library Photo 2 credit: Smithsonian Institution