Why you need it

If you find out how many servers you need on launch day, it is too late: the site is already drowning. A rough sum done before launch tells you whether you need one server or fifty, and costs five minutes.

Think of it like this

Planning a wedding dinner. You do not count every grain of rice. You say "200 guests, one plate each, a cook makes 50 plates an hour, so we need 4 cooks". Rough, but it stops you hiring one cook for 200 people.

Where you’ll find it

  • Kubernetes: Its Horizontal Pod Autoscaler does this sum every few seconds: load divided by what one copy can take, rounded up.
  • AWS: EC2 Auto Scaling adds or removes servers to keep each one near a target load you choose.
  • Google: Built a planning tool, Auxon, that turns expected demand into how many machines to buy and where.

What to know first

Requests per second. How many questions arrive each second. It is the usual unit for load on a server.

A day is about 100,000 seconds. It is really 86,400, but 100,000 is close enough for quick sums and easy to divide by.

Peak. The busiest moment, not the average. Traffic is often 2 to 10 times higher at peak, for example in the evening or during a sale.

Headroom. Spare room you keep on purpose, so a surprise spike or a dead server does not tip you over.

How it works

  1. Start from people, end at requests per second. Users per day, times requests each user makes, divided by seconds in a day. 1 million users making 20 requests each is 20 million a day, about 200 a second.
  2. Plan for the peak, not the average. Multiply by how much busier the busiest hour is. If evenings are 5 times busier, plan for about 1,000 a second.
  3. Measure what one server can do. Do not guess this number. Load test one server: send more and more requests until answers get slow (watch the p99, see Latency and percentiles). That point is its real limit.
  4. Divide, round up, add headroom. Peak divided by one server's limit, rounded up. This is the sum in the animation. Then add spare servers, because running every server at 100% means the first spike or failure takes you down.
  5. Check the other limits too. Requests are not the only thing that runs out. Do the same quick sum for storage (how much data a day), network (how many bytes a second) and memory.

An example

A photo app expects 1 million users a day. Each opens it 20 times: 20 million requests, about 200 a second on average.

Evenings are 5 times busier, so the peak is about 1,000 a second.

A load test shows one server stays fast up to 200 a second. 1,000 divided by 200 is 5 servers.

Keep each server at about 60% so there is room for spikes: 1,000 divided by 120 is about 9. Plan for 9 or 10 servers, not 1, and not 100.

Storage: each user uploads one 2 MB photo a day. That is 2 terabytes (TB) a day, about 730 TB a year, which is a very different problem from the servers.

Further reading

  • Napkin Math, Simon Eskildsen. The numbers you need for quick sums, with exercises. Very practical. Start with this one.
  • Little's law, Wikipedia. One line of maths: requests in flight = arrival rate × time each takes. Handy for sizing.
  • Software Engineering in SRE, Google SRE book. How Google turned capacity planning into a tool. Free to read.
  • Horizontal Pod Autoscaling, Kubernetes docs. See the exact formula a real system uses to do this sum by itself.