[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Gangnam Style overflows INT_MAX, forces YouTube to go 64-bit
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 40
Thread images: 1
File: int overflow.jpg (41 KB, 794x827) Image search: [Google]
int overflow.jpg
41 KB, 794x827
http://arstechnica.com/business/2014/12/gangnam-style-overflows-int_max-forces-youtube-to-go-64-bit/

Although it's no longer 2012, apparently people are still watching the YouTube video for Korean pop star Psy's smash hit song Gangnam Style.

The irritatingly catchy tune has racked up so many views that Google has been forced to upgrade YouTube's infrastructure to cope. When YouTube was first developed, nobody ever imagined that a video would be watched more than 2 billion times, so the view count was stored using a signed 32-bit integer.

The maximum value of this number type, 2,147,483,647, is well known to C programmers as INT_MAX. Once INT_MAX is reached, attempting to record another view will normally roll over to -2,147,483,648.

YouTube isn't the only software that this number is a problem for. Unix systems record time values as the number of seconds since 00:00:00 UTC on January 1, 1970. 32-bit systems use a signed 32-bit integer for this, so they will wrap around 2,147,483,647 seconds after that date. Two billion seconds is about 68 years; on January 19, 2038, at 03:14:07 in the morning, 32-bit Unix clocks will roll over.

While not a problem for desktops and servers, which have already made the switch to using 64-bit counts for the time, it's possible that embedded systems will continue to be 32-bit even 24 years from now.

As for YouTube, upgrading to a 64-bit signed number means that Gangnam Style is safe until it reaches 9,223,372,036,854,775,807 views. That's not likely to occur for another 4 billion years or so.
>>
>>45465620
Should be signed int, but whatever.
>>
>>45465643
in the picture i mean
>>
Why on earth did they choose signed int? Did they expect negative view counts? Fucking retards.
>>
>>45465760
https://www.youtube.com/watch?v=Dg_OIipJuds
>>
>>45465760
The Google C++ style guide says to use an unprefixed (ie. signed) int when you don't really care how a number is stored, but to use an stdint.h type when you do since those are guaranteed to be the same size across compilers and platforms.

Seems reasonable to me.
>>
>>45465785
i was expecting a video with negative view counts sigh
>>
I don't buy it. They're taking it too lightly, being too public about it. If it was legitimate they would be freaking out about the integrity of their data, whether ranking algorithms are affected, reviewing their code to make sure it never happened again. Smells like a publicity stunt.
>>
>>45465947
Why would a view count cause problems? Overflow would just make negative numbers.
>>
>>45465947
It could have been a 64-bit value in the database but casted to 32-bits somewhere down the HTML rendering pipeline.
>>
>>45465947
>smells like a publicity stunt
That's because it is. It's a humble brag.

>our service is so popular and successful that we had to upgrade our infrastructure!
>>
>>45465620

>Although it's no longer 2012, apparently people are still watching the YouTube video for Korean pop star Psy's smash hit song Gangnam Style.

So, songs have a best before date now?
>>
Why a signed int though?
>>
>>45466264
If they're using Java, there are no unsigned integer types.
>>
>Gangnam Style overflows INT_MAX, forces YouTube to go 64-bit
That took long, even apple was already using 64bit systems.
>>
>>45466140
duh, don't you listen to radio?
>>
>>45466140
Pop songs always did.
>>
>>45466312
google uses python
>>
>>45466312
Google are using C++ wherever possible...
>>
>>45466385
>Google is using C++ wherever possible...
ftfy
>>
>>45466382
Google uses C++, Java, Python and occasionally Go. There are no 32 bit ints on 64 bit builds of Python so it probably wasn't used here.

>>45466385
If this code was C++ then >>45465811 applies.
>>
>>45466385
And you're so wrong wherever possible...

Google uses Java and Python
>>
>>45465825
Hover your mouse over the view count
>>
>>45466382
Python doesn't have unsigned ints either smartass.
>>
>>45466501
This does nothing.
>>
>>45466507
pls be in london
>>
>>45466575
u wot m8

im up north
>>
>>45466140
http://www.google.com/trends/explore#q=%2Fm%2F0kfzw66
Half-life is like much less than half a year.
>>
>>45466566
It used to show the negative view number...
>>
time_t already fixed in OpenBSD
>>
>signed int for a counter
sweet jesus.
>>
>>45466414
Now that's interesting. I'm not a native speaker, and in my language companies and organizations are usually used as plural words ('THEY did etc').
>>
>>45466964
but google is a company. one. uno.
>>
>>45466975
I don't think you got my point. But I might have worded it wrongly.
>>
>>45467008
What is your mother tongue?
>>
>>45466964
Both is and are are accepted. Are is more correct.
>>
>>45466964
You can use either, but it can have a subtle difference in meaning. "Google is" refers to Google the abstract entity, but "Google are" refers to the collective individuals who work at Google.
>>
>>45465620
The real question is why the fuck they're not using size_t. It's probably the worst beginner mistake since forgetting to free(allocated_memory).
>>
>>45467887
How is size_t appropriate? It's not even guaranteed to be more than 16 bits per the C99 spec.

Use stdint types.
>>
>>45468011
I assumed they record every visit. Google records everything, because data is valuable.
Thread replies: 40
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.