Here's an additional thing to think about...
If you look on peoples profiles here on ATS, you'll see that next to threads they've posted it will say "0 views". When I first came to ATS, I
wondered why that doesn't work, and found some threads in the board business section, here is just one:
www.abovetopsecret.com...
In that thread, one of the problems with maintaining view counts is explained by The Overlord, and it matches what I know about databases. Everytime
a view count is updated, it has to make a write to a database. Reading from a database is fairly cheap (in CPU time/computer usage), and most of the
ATS site is built on the idea of reading from a big database. However, any time you write to a database, you have to lock it, then write, then
unlock, which is very expensive.
Here is a very basic breakdown, as I was taught in my computer science course.
Say you have a bank account database, and two clerks are accessing it at the same time. They both plan to credit your account. Call them A and B.
Without locking, the scenario might end up looking like this:
A reads your balance as $100
B reads your balance as $100
A wants to deposit $10, so adds $10 to the $100 it read, then writes the database to say $110
A wants to deposit $50, so adds $50 to the $100 it read, then writes the database to say $150
You just lost $10!
With locking, it might look like this:
A wants to deposit $10, so locks the database, and reads the balance
B wants to deposit $50, but the database is locked, so it has to wait...
A writes the new balance as $110, then unlocks the database
B now sees the database is unlocked, and makes it's own lock, reads the balance as $110, writes the new balance as $160, and unlocks.
All those locks add a big overhead to the servers. In ATS case, they decided that the feature wasn't worth the cost of buying more powerful
servers.
What I expect YouTube has done, is they have got another server(s), which just hold the amount to be updated. They are a big site, and can afford to
do this. This releases the strain on their main servers, then at some point when the main server is not too busy, they will consult the server that
has been counting the hits, and add them onto the main servers count.
Now, it will be a little bit more complicated than this in reality, as YouTube has many many servers, but I hope this helps people understand the
problems involved.
[edit on 12/9/2009 by harpsounds]