Core system concepts · Concept lesson
Capacity estimation
Work out, with simple arithmetic and stated guesses, how many requests a service must handle and how many servers that takes.
Written for a first reading. Nothing is assumed, and each new word is explained where it appears.
Original educational architecture · Version 2026-11-12.1 · Examples use stated hypothetical assumptions, not a company's actual design.
What you will be able to explain
- Turn a description such as “24,000 users” into requests per second, showing each step and its units.
- Work out how many requests are in progress at once, and how many servers are needed with room to spare.
- Say which of your guesses matter most and how you would test them.
What an estimate is
Before building a service, someone has to decide how many servers to run and how big the database should be. Nobody knows the exact answer in advance. An estimate is a careful guess, with the working shown.
A caterer does the same. Two hundred guests, three in four will eat the main course, so 150 portions, plus a few spare. The caterer may be wrong, but anyone can see which guess to change when the guest list does.
A capacity estimate has the same parts: who uses the service, how often, how much work each use causes, and how much one server can do. You multiply and divide these, keeping the units, and add room to spare.
The answer is not a promise. It is a starting point that tells you what to test.
How many are active and how many actions each takes.
The same information as a rate, at the busiest time.
Measured: requests per second while still quick enough.
Enough for the peak, a burst and one server failing.
Send that much traffic and see whether the guesses held.
- People and what they do → Requests per second: divide by time
- Requests per second → What one server can do: compare
- What one server can do → Servers, with room to spare: divide, then add spare
- Servers, with room to spare → Test: the target to test
- Test → What one server can do: correct the guesses
Start with units, and with the busy time
Most mistakes in estimates are unit mistakes. Write the unit beside every number, and check that it cancels the way it should. Requests divided by seconds gives requests per second. Requests per second multiplied by seconds gives requests.
Two numbers are worth knowing by heart. A day has 86,400 seconds; rounding to 100,000 is close enough for a first pass. An hour has 3,600.
Do not plan for the daily average. People do not spread their use evenly over 24 hours. A service that handles its average comfortably can still fall over at lunchtime. Find the busiest period and estimate for that.
| To get | Do this | Example |
|---|---|---|
| Requests per second | Requests ÷ seconds | 36,000 requests in 600 s = 60 per second |
| Requests in a period | Requests per second × seconds | 60 per second × 3,600 s = 216,000 in an hour |
| A day's average | Requests in a day ÷ 86,400 | 8,640,000 a day = 100 per second |
Worked example: from 24,000 people to seven servers
A service has 24,000 people using it during its busiest ten minutes. In those ten minutes, each of them makes 3 requests on average.
Requests in the busy period: 24,000 people × 3 requests = 72,000 requests. Ten minutes is 600 seconds. So the rate is 72,000 ÷ 600 = 120 requests per second.
That is still an average, over ten minutes. Within it, some seconds are busier than others. Suppose past measurements show the busiest seconds reach two and a half times the average. Then plan for 120 × 2.5 = 300 requests per second.
Now the servers. Suppose a test shows that one server handles 75 requests per second while still answering quickly enough. Then 300 ÷ 75 = 4 servers would just cope.
But four servers running flat out have nothing to spare. If one breaks, the other three cannot carry the load. A common rule is to plan for each server to be about 60% busy at the peak. Then you need 4 ÷ 0.60 = 6.67, which you round up to 7 servers.
Check it backwards. Seven servers at 75 each can handle 525 requests per second. The peak of 300 is 57% of that. If one server fails, six remain, with 450 per second, and the peak is 67% of that. It still fits.
| Step | Working | Result |
|---|---|---|
| Requests in the busy ten minutes | 24,000 × 3 | 72,000 requests |
| Average rate in that period | 72,000 ÷ 600 s | 120 per second |
| Busiest seconds | 120 × 2.5 | 300 per second |
| Servers running flat out | 300 ÷ 75 | 4 servers |
| Servers at 60% busy | 4 ÷ 0.60 | 6.67, so 7 servers |
How many requests are in progress at once
Some things are used up by requests in progress, not by requests per second. Memory is one: each request being handled holds some until it finishes. Database connections are another.
There is a simple rule for this, known as Little's Law. The average number in progress equals the arrival rate multiplied by the average time each one takes.
A shop makes it plain. If 2 customers arrive each minute and each stays 5 minutes, then on average 2 × 5 = 10 customers are inside.
For the service above: 300 requests per second, each taking 0.18 seconds on average, gives 300 × 0.18 = 54 requests in progress. If each holds about 2.5 MB of memory while it runs, that is 54 × 2.5 = 135 MB for requests alone. The program itself needs more on top.
Notice what happens if the service slows down. At 1.8 seconds per request, the same arrival rate means 540 in progress, ten times as many. Slowness by itself fills a service up. This is why a slow dependency can bring a healthy service down.
Estimating storage
Storage is estimated the same way: how many things, how big each is, and how long they are kept.
Suppose the service stores 2 million new records a day and each is about 1 KB. That is 2 million KB, or about 2 GB a day. Kept for a year, that is 2 × 365 = 730 GB.
Then count the copies. Important data is usually kept in three places, so that losing one machine loses nothing: 730 × 3 = 2,190 GB, about 2.2 TB. Backups and the indexes that make searches fast add more. A first estimate that counts only the raw data is often half the real figure.
| Unit | Roughly |
|---|---|
| 1 KB (kilobyte) | A short paragraph of text |
| 1 MB (megabyte) | 1,000 KB: a photo from a phone |
| 1 GB (gigabyte) | 1,000 MB: an hour of video |
| 1 TB (terabyte) | 1,000 GB |
How estimates go wrong
An estimate fails when one of its guesses was wrong and nobody checked. These are the usual ones.
When demand does exceed capacity, a well-built service protects itself. It turns away some requests quickly with a clear “try again later”, so that the ones it accepts are still answered in time. Answering nobody is the worse outcome.
- Planning for the average. The peak is what breaks a service.
- Forgetting retries. When a service is slow, apps try again, and the traffic rises just when it can least be handled.
- Counting only the servers. The database they all share may run out first.
- Assuming two servers do twice the work of one. Shared parts, such as the database, often stop that.
- Testing with traffic that is too simple. Real users do a mix of cheap and expensive things.
- No room for a broken server. Machines fail, and updates take servers out of service one at a time.
An estimate is a guess to test
Every number in the worked example was either measured or guessed. The 75 requests per second for one server was measured. The 2.5 for the busiest seconds was a guess from past traffic. Say which is which. The guesses are where to spend your testing.
A load test sends made-up traffic at the rate you estimated and watches what happens. You are looking for the point where answers start to slow down, and for which part is the first to run out: processor, memory, or database connections.
Then test a failure. Take one server away at peak traffic and see whether the rest cope. An estimate that has survived both tests is one you can rely on.
After launch, compare the estimate with real traffic and correct it. In an interview, saying which guess you trust least, and how you would check it, shows more skill than a precise-looking number.
Going further
These points go beyond a first reading. Come back to them after the later lessons.
Response time does not rise in a straight line as a server gets busier. It stays flat for a long while and then climbs steeply. That steep climb is the real reason for leaving room to spare.
Averages hide the slowest requests. A capacity target is better stated as “99 in 100 requests answered within 300 ms at 300 requests per second” than as an average.
The capacity worksheet in the practice section recomputes this arithmetic as you change the inputs. Use it to see which input moves the answer most.
Terms in plain language
- Capacity
- How much work a system can do in a period while still answering quickly enough.
- Requests per second
- How many requests arrive, or are finished, each second. The usual unit for how busy a service is.
- Peak
- The busiest period, as opposed to the average over a day.
- Concurrency
- How many requests are in progress at the same moment.
- Headroom
- Capacity left unused on purpose, so a busy moment or a broken server does not cause an overload.
Capacity lab
Change the assumptions and inspect the math. This teaching model assumes every request creates one stored record. Real systems separate reads, writes, uploads and background work.
- Average QPS
- 231.48
- daily users × requests per user / 86,400
- Peak QPS
- 1,157.41
- average QPS × peak multiplier
- Peak payload bandwidth (MB/s)
- 1.16
- peak QPS × bytes/request / 1,000,000
- Logical retained storage (GB)
- 600
- requests/day × bytes/request × retention / 1,000,000,000
- Replicated storage (GB)
- 1,800
- logical storage × stored copies
- Serving nodes
- 1
- ceil(peak QPS / (node throughput × utilization))
Decimal MB/GB, not MiB/GiB. Indexes, protocol overhead, compression, retries, backups and failover capacity are excluded. Measure throughput on your workload; this is not a sizing guarantee or a cloud price quote.
References and boundaries
Primary documentation supports the mechanisms described. It does not certify these hypothetical architectures, prices or sizing assumptions. Review platform-specific behavior before implementation.
How a service should behave when demand exceeds what it can handle, including turning requests away early.
A cloud provider's guidance on measuring a workload and testing its capacity.