Why do YouTube views freeze at 301?


Uploaded by numberphile on 22.06.2012

Transcript:

BRADY HARAN: I want to deal with a number that must be the
most requested so far on Numberphile, and that is 301.
Now, for those of you who don't pay much attention to
the YouTube view counters, you might wonder what the big deal
is with 301, and let me tell you.
When a new video is uploaded, and if it's quite a popular
one, you'll quickly see the view counter rise and rise and
rise, and then it will get to 301, and it will freeze.
And it will stay on 301 for a day, maybe half a day, and
then it will start counting to higher numbers as usual.
Now, a lot of people have been very mystified by this, and
have asked us to check it out.
TED HAMILTON: I'm Ted Hamilton, I'm a product
manager for YouTube Analytics.
BRADY HARAN: So there you go.
I've got in touch with the people who actually count the
YouTube views.
TED HAMILTON: That is correct.
Well, we actually have the computers do it.
We don't count them ourselves, but yes.
BRADY HARAN: So before we get to this whole 301 malarkey,
what is a view on YouTube?
I've always wondered.
is someone just pressing play counting as a view?
TED HAMILTON: Well, that's actually a bit
of a YouTube secret.
A view should be a video playback that was requested by
an actual user who got what they were intending to get and
had a good user experience.
We think of views as a currency, and therefore we
have to make a significant effort to eliminate
counterfeit views, if you will.
BRADY HARAN: Now, I know that all sounds a bit mysterious,
and we will come back to it later on in the video, but
let's crack on with this 301 figure.
And you're going to find out counterfeit views actually
have a bit to do with it.
But the next thing we need to realize is when you watch any
video, like this one for example, you're probably not
all watching it from the same server.
It gets distributed all around the world.
TED HAMILTON: So there is the original, which
you will have uploaded.
Or I guess by the time you are watching this,
have already uploaded.
Then this gets, what do you call it?
Cached in different locations, so that when you make a
request for a video, it doesn't need to travel all the
way from London over to California and say OK, send me
back all of these bytes way back here.
BRADY HARAN: So with multiple copies of the video all around
the world, counting the views starts to get a little bit
more complicated.
TED HAMILTON: Here's you at your computer
watching the video.
If you make a request to this server, this server is going
to give you the video, right?
And at the same time, this server is going to write a
little message to a log.
It's just one line in a log.
Every once in awhile, we collect all of these logs.
So we'll ship this thing in from central Europe, or
whatever into the central log collection area, aggregate
them all together, and then go through and count them up.
BRADY HARAN: Well OK, that seems simple enough, but it
doesn't explain why the view counter freezes.
TED HAMILTON: Views, as mentioned, are a currency.
When you have a video with a very small amount of views,
then you don't need to be too careful about
what that view was.
However, once it gets to be above 300 and beyond, this
currency we really need to verify and make sure that the
number is what it purports to be.
So this means that we have to go through a statistical
verification process, and that statistical verification
process actually takes some time.
And thus we go from incrementing one by one to
then saying, OK, now we're incrementing in batch, and all
of these views that have been added on have been verified by
YouTube to be real views.
We are preventing things like bots to go in and add a bunch
of views to a video.
Or we are preventing something that may have perhaps misled
someone into watching a video.
Say you had a title that was completely misleading, and a
thumbnail that was completely misleading, and people
actually went on there and just viewed for a few seconds,
and then left.
If you see that enough times, it a fair enough indicator
that something was wrong there, so that we might not
authorize all of those to be legitimate views.
BRADY HARAN: All right, then.
They're verifying the numbers.
They're checking everything.
I guess we probably could have guessed that.
But why 301?
TED HAMILTON: I was not there when the decision was made,
but at some point the decision was made that we need to draw
a line between what is innocuous and the database can
handle, and what is all of a sudden serious business.
The proportion was calculated to be at about 300, that this
is the portion that we need to take care of.
But the formula that we use to arrive at 300, I don't know if
anyone actually knows that.
BRADY HARAN: Well, OK.
They drew a line in the sand.
It was kind of arbitrary.
They wanted to differentiate between people just sharing
their home movies and the videos that are more popular,
the ones that are a bit more serious.
The ones that need scrutiny.
But that was 300.
The view counter freezes at 301.
What's going on here?
Is there a reason?
TED HAMILTON: Yeah, there is a reason.
And the reason was the number 300 was chosen.
And when someone's writing code, they need to put the
logic in the code that says where you should stop, or
where you should, if one condition is true,
you go to the left.
And the other condition is true, you go to the right.
Now, this condition can be written like this.
If the view count is less than 300, then go ahead and add one
to the view count.
Otherwise, go to x where x is our much more complicated view
count pipeline.
However, what actually got written was not this, but if
view count is less than or equal to 300, then increment
the view count.
So what this means is if the view count is at 300, this
says is the view count less than or equal to 300?
Yes, it is.
Let me add one.
So then you end up at 301.
BRADY HARAN: Let me recap what's going on here.
The code which is controlling where this view counter
freezes contains a less than or equal to sign.
So that means when a new early view comes along, it's checked
against the code.
Say the overall view count on the database is 299.
OK, then.
We'll let another one on.
Here comes another view.
Now the view count is 300.
That isn't less than 300, but it is equal to 300.
So the code lets another view jump onto the total.
Now we're at 301, and when another view comes along, it's
not less than 300, but it's also not equal to 300 anymore,
and the door is shut.
There are going to be no more views added to the publicly
visible count until YouTube have done their checks.
And that will take half a day to a day.
Then of course, all the extra views that have been counted
in the interim all pile onto the total.
Nothing's missed.
At least that's what I'm told.
TED HAMILTON: Yeah, so whoever wrote this code probably did
not realize the magnitude of what they were doing.
View counts have been around since the beginning of
YouTube, and who was to know what YouTube would become.
So yeah, that was actually a rather monumental second of
time in San Bruno, California, when a coder decided to write
that logic in.
It is now one of the idiosyncrasies of YouTube.
BRADY HARAN: Now, I can hear some of you screaming at your
computer screens.
The view count doesn't stop at 301.
Sometimes it stops at 302, or 305, or 310.
What's going on there?
There's an explanation for that, too, and that comes back
to how I was saying the videos are shared around servers all
across the world.
So here's what's going on there.
Views are coming in from the logs at the different videos,
the different places around the world.
And they're coming to this central database.
And we know the door's going to be shut at 301, we just
explained that a minute ago.
But what happens if views are coming in at the same time?
Someone watched it in Africa at the exact same time someone
watched in Europe.
Now we've got multiple views coming in.
Checking if they're allowed to join the count, yes they are.
It's less than or equal to 300.
So they all pile on at the same time.
Now when a new view comes along, sorry,
we're closed for business.
But because of that simultaneous update, a few
extra views were able to sneak on.
TED HAMILTON: We get asked about it all the time.
I wouldn't say that it causes angst, but it's certainly, I
would classify it more as an annoyance.
You can go and see a very popular video, and you look
and you'll see that it has 2,000 likes and 300 views.
That's a little bit interesting.
The issue there is that we don't put the likes through
the same rigor, same rigorous process.
And likes are far fewer in magnitude, so our systems can
handle them more easily.
But the views do freeze, and it can result in some awkward
situations.
But that actually results in terrific videos like this, so.
BRADY HARAN: I did speak to Ted for maybe 45, 50 minutes
and recorded it all.
I've got loads of footage, a lot more detail, including a
bit more about what constitutes a view.
And I know some of you will want to see it.
I haven't had time to edit it all just yet, but stay tuned
because I'll be uploading that to
Numberphile in the near future.
And for those of you who don't like these ones that are a bit
more about computers and the internet, I'm sorry.
Numberphile's always unpredictable, and I promise
next time it might be something
you enjoy a bit more.

MATT PARKER: How many arrows do you want?
So the next one, let's say we did 3 to the power of, to the
power of, oh, arrow, arrow, arrow, or whatever you
want to call this.
3.
Will that--