Saturday, December 6, 2014

Gangnam Style breaks 32bit counter on YouTube


Computer History is filled with "that should be more than enough" moments over the decades, but if you thought those days were gone... here's one new case: Psy's Gangnam Style just broke the YouTube view counter.

Some of you may still remember the 640KB MS-DOS memory limit, os even the 32 bits IP address that once was also considered more than enough for "anything" that would be on the internet. Now, it's YouTube that has to face a similar 32 bit problem.

Computer store data in bits. As each bit can only store 1 or 0, bigger numbers require more bits. Two bits allow you to store up to 4 values; 4 bits up to 16; and so on. If you also want to store negative numbers, that number gets halved, and that's why a 32 bit counter allows you to store a maximum positive value of 2,147,483,647 - a value that YouTube thought would be more than enough to keep track of its videos, but that Gangnam Style recently surpassed.

As an easter egg, if you place your mouse over the YouTube counter, you'll see it overflow into the negative range. And actually, simply turning the 32bit signed integer into a 32 bits unsigned integer (as it should have been from the start - as you don't get negative video views), is enough for YouTube to keep running without incidents for a while longer, until you get to 4.29 billion views.

But to really make it future proof, the best option is to expand that counter up to 64 bits. Then you'll be able to store up to the ridiculous amount of 18,446,744,073,709,551,615. (And if think that's still not enough, let's just say that it would be enough to keep track of a video that was viewed a million times per second... for over half a million years!)

No comments:

Post a Comment

Related Posts with Thumbnails

Amazon Store