What happens when a website goes viral: how a site keeps up with millions of visitors
Server capacity: why a website slows down for everyone at once
A website works fine for a hundred visitors. Then a big crowd arrives at once, and the website stops answering. It does not fail only for the last visitors. It fails for everyone.
-
1
You made a small website with a new word puzzle every day, the same word for every player. At 9:00, Miva and a few others open it, and your server, the computer that sends them the puzzle, has almost nothing to do.
-
2
At 9:01, Rono, a singer with millions of followers, posts his score and the link. It does not stay a small website for long.
-
3
By 9:05, two million people want today's puzzle. Each tap sends a request, a short message that asks your server for the page, and each request costs the server a little work.
-
4
Your server can work on only so many requests at the same time: that is its capacity. The others wait in a line, and at 9:05 the line grows much faster than the server can empty it.
-
5
A new request joins the back of the line and waits for every request in front of it. So the wait grows for everyone who taps, even early players sending their next guess. Past a certain wait, the request is dropped: a timeout.
-
6
Worse, the server keeps working on requests whose players already gave up. Even Miva, who came at 9:00, sends her next guess and sees nothing load. Too many requests did not just slow the site down for some players: they stopped it for all of them.
-
7
Miva sends you a fix that sounds obvious.
-
Quick check
A bakery can serve 60 customers an hour. On a holiday morning, 80 an hour walk in, hour after hour.
Show the answer
It grows. Each hour, 20 more people come in than the bakery serves, so each new customer waits longer than the one before.
-
Go further
The morning, with the names people use.