Back-of-Envelope Estimation: Sizing QPS, Storage, Bandwidth and Servers on a Napkin
A team launches a photo feature and provisions storage “generously”: 50 TB, which felt enormous in the planning meeting. Nobody multiplied it out. Ten million photos a day at 2.5 MB each, original plus resized variants, is 25 TB a day. The bucket alarm fires on day two.
A different team sizes a database connection pool at 500 per app server “to be safe”. With 40 app servers that is 20,000 connections pointed at a database that handles a few hundred well. The first traffic spike does not overload the app tier. It overloads the database with connection churn, and every request times out.
Both mistakes are one line of arithmetic away from being caught. Back-of-envelope estimation is that line of arithmetic, done before anyone writes code or buys hardware.
What it is
Back-of-envelope estimation is order of magnitude arithmetic that converts a product description (users, actions, object sizes) into engineering numbers (requests per second, peak load, bytes stored, bits per second, requests in flight, machines needed). The target precision is a factor of two or three. The goal is to know whether you are building for 100 requests per second or 100,000, because those are different architectures.
In the system design framework it is step 3, and it is what makes the later steps defensible.
How it works
The pipeline is always the same: start from people, convert to events per day, divide by seconds, apply a peak factor, then multiply by sizes and latencies.
flowchart LR A["DAU"] -->|"x actions per user"| B["Events per day"] B -->|"divide by 86,400"| C["Average QPS"] C -->|"x peak factor"| D["Peak QPS"] D -->|"x payload size"| E["Bandwidth"] B -->|"x object size x replicas x retention"| F["Storage"] D -->|"x mean latency, Little's law"| G["Concurrency"] D -->|"divide by per-server capacity"| H["Server count"] style A fill:#EEEDFE,stroke:#534AB7,color:#3C3489 style C fill:#E1F5EE,stroke:#0F6E56,color:#085041 style D fill:#FAEEDA,stroke:#854F0B,color:#633806 style E fill:#F1EFE8,stroke:#888780,color:#444441 style F fill:#F1EFE8,stroke:#888780,color:#444441 style G fill:#F1EFE8,stroke:#888780,color:#444441 style H fill:#F1EFE8,stroke:#888780,color:#444441
Powers of two and powers of ten
Memory and storage sizes are powers of two; traffic and money are powers of ten. For estimation, treat them as the same. The error is under 13% even at the petabyte level, which is far below the uncertainty in your inputs.
| Power of two | Exact value | Approximation | Name |
|---|---|---|---|
| 2 to the 10 | 1,024 | 1 thousand | KB |
| 2 to the 20 | 1,048,576 | 1 million | MB |
| 2 to the 30 | about 1.07 billion | 1 billion | GB |
| 2 to the 40 | about 1.10 trillion | 1 trillion | TB |
| 2 to the 50 | about 1.13 quadrillion | 10 to the 15 | PB |
Two conversions catch people constantly. Network speeds are in bits, storage in bytes: 1 Gbps is 125 MB/s, and 10 Gbps is 1.25 GB/s. And “a million” times “a thousand bytes” is a gigabyte; “a billion” times “a kilobyte” is a terabyte. Count zeros, or count the K, M, G, T steps (each is three zeros).
Typical sizes
| Thing | Size |
|---|---|
| int64, timestamp | 8 bytes |
| UUID | 16 bytes binary, 36 bytes as text |
| IPv4 / IPv6 address | 4 / 16 bytes |
| A short text post with metadata | 0.5 to 1 KB |
| A typical JSON API response | 1 to 10 KB |
| A compressed web image | 100 to 500 KB |
| A smartphone photo, original | 2 to 5 MB |
| 1080p video | roughly 5 Mbps, so about 2 GB per hour |
Database rows cost more than their payload. Indexes, per-row overhead and free space often add 1.5x to 3x. Use 2x if you have nothing better.
Seconds per day, and the shortcuts that follow
A day has 86,400 seconds. Round it to 100,000 (10 to the 5) for mental math and remember your answer is about 15% low. A month is about 2.6 million seconds, a year about 31.5 million (call it 3 x 10 to the 7).
Shortcuts worth memorising:
- 1 million requests per day is about 12 per second.
- 1 billion requests per day is about 12,000 per second.
- 1 request per second sustained is about 86,000 per day and 31.5 million per year.
QPS from DAU
average QPS = DAU x actions per user per day / 86,400
Do it separately for reads and writes; they usually have different paths, different stores and ratios of 10:1 to 1000:1.
Peak factors
Traffic is not flat. Consumer products typically see a daily peak of 2x to 3x the daily average, because users are concentrated in a few time zones and waking hours. Events push far higher: a product launch, a push notification sent to every user at once, a sports final, or a retry storm after an outage can be 10x or more. Design capacity for the daily peak with headroom, and decide explicitly how you handle spikes beyond it (autoscaling, queueing, or load shedding).
Peak factors also apply to the unit of time you measure. A per-minute average hides per-second bursts. If a cron job fires at the top of every hour across 10,000 clients, the second after the hour is the real peak.
Storage
storage = writes per day x bytes per write x replication factor x retention days
Add index and metadata overhead. Separate hot data (must be on fast storage, often in a database) from cold data (object storage, cheaper by an order of magnitude). Media almost always goes to object storage and only its metadata goes into the database.
Bandwidth
bandwidth = QPS x bytes per response x 8 for bits per second.
Compute ingress (uploads) and egress (downloads) separately. Egress is almost always the larger and the more expensive, which is why it goes through a CDN.
Little’s law: concurrency and pool sizing
Little’s law relates three averages in any stable system:
L = λ x W
L is the average number of items in the system (requests in flight, open connections, busy threads), λ is the average arrival rate, and W is the average time each item spends in the system. It holds for any arrival pattern and any service order, as long as the system is stable (arrivals do not outrun departures over the long run). The averages matter: plug in the mean latency, not the p99. The p99 tells you about the tail; Little’s law needs the mean. Latency vs throughput covers what happens to W as load rises.
Little’s law answers questions like:
- Requests in flight: 5,000 requests per second x 0.2 s mean latency = 1,000 requests in flight across the fleet.
- Connection pool size: if each request holds a database connection for 4 ms on average, 5,000 x 0.004 = 20 connections busy on average.
- Concurrent users: 10 million sessions per day x 30 minutes average session length. λ = 10,000,000 / 86,400 = 116 sessions per second; W = 1,800 s; L = 116 x 1,800 = about 210,000 concurrent sessions.
L is an average. Real concurrency fluctuates around it. With random arrivals, the fluctuation is roughly the square root of L, so a pool sized at L plus three times the square root of L rarely runs dry. For L = 20 that is 20 + 3 x 4.5, about 34.
flowchart LR IN["Arrivals<br/>lambda = 5,000 per s"] --> SYS["System<br/>L = lambda x W = 1,000 in flight"] SYS --> OUT["Departures<br/>5,000 per s"] SYS -.- W["W = 200 ms mean<br/>time inside"] style IN fill:#E1F5EE,stroke:#0F6E56,color:#085041 style SYS fill:#EEEDFE,stroke:#534AB7,color:#3C3489 style OUT fill:#E1F5EE,stroke:#0F6E56,color:#085041 style W fill:#FAEEDA,stroke:#854F0B,color:#633806
Server count
For CPU-bound services, compute capacity from CPU time per request:
max requests per second per server = cores / CPU seconds per request
A 16 core server with 20 ms of CPU per request saturates at 16 / 0.02 = 800 requests per second. Do not plan to run at saturation. Queueing delay explodes as utilisation approaches 100%, so plan for 50% to 70%. At 60%, that server is good for about 480 requests per second.
servers = peak QPS / (per-server capacity x target utilisation), then add redundancy: enough spare capacity to lose one server, or one whole availability zone. With 3 zones, surviving the loss of one means provisioning 1.5x what you need, because two zones must carry the full load. The reasoning behind that is in availability and fault tolerance.
For I/O-bound services, the limit is usually concurrency (threads, connections, memory per connection), so use Little’s law instead.
Try it
Change DAU, writes per user and object size below and watch which number becomes the constraint. Try 1 billion DAU with 1 KB objects, then 10 million DAU with 2,000 KB objects.
Worked examples
Where it breaks
Averages hide the peak. Sizing for average QPS means you fall over every evening. Always carry the peak factor, and ask what the spike case is.
Bits versus bytes. Mixing them is an 8x error, the single most common slip in bandwidth estimates.
Forgetting multipliers. Replication (3x), indexes (up to 2x or more), backups, logs, and the derived copies (thumbnails, search indexes, analytics). Real storage is often 5x to 10x the raw payload.
Compounding optimistic assumptions. Five inputs that are each 1.5x too low make the answer 7.6x too low. When unsure, round the inputs that matter most upward and say so.
Ignoring cache hit rates. A cache with a 95% hit rate means the database sees 5% of reads, but on a cold start or a cache flush it sees 100%. Size the database for the cache-miss case you can tolerate, a theme of cache stampedes and hot keys.
Precision theatre. Spending three minutes computing 34,722.2 instead of saying “about 35,000” wastes time and signals the wrong priority. Round early, round often.
Using p99 in Little’s law. Little’s law is about averages. Plugging p99 latency in overestimates concurrency, sometimes by 10x, and leads to oversized pools that hurt the database.
Treating rule-of-thumb capacity as fact. The capacity of “a server” varies by 100x with the workload. If you have a benchmark, use it. If not, state the number as an assumption.
Real-world reference points
These are order of magnitude planning figures, not benchmarks. Measure your own workload before committing money.
| Component | Order of magnitude capacity |
|---|---|
| Stateless API server, moderate work per request | 1,000 to 10,000 requests per second |
| Relational database primary on NVMe, simple indexed queries | thousands to tens of thousands of queries per second |
| In-memory cache node (Redis, Valkey, Memcached) | around 100,000 or more simple operations per second |
| Connection gateway holding idle WebSockets | hundreds of thousands of connections per server |
| A 10 Gbps network link | 1.25 GB/s, about 4.5 TB per hour |
The hardware behind these numbers, and why a network round trip inside a data centre costs about the same as thousands of memory reads, is in latency numbers every engineer should know.
How to apply it
A two minute estimation routine:
- Write the inputs as assumptions: DAU, actions per user, read to write ratio, object sizes, peak factor, retention.
- Compute writes per second and reads per second separately. Use 100,000 seconds per day for speed.
- Multiply by the peak factor.
- Storage per year: writes per day x size x replicas x 365. Split hot and cold.
- Bandwidth: QPS x response size x 8 for both directions.
- Concurrency with Little’s law if connections, threads or sessions matter.
- Server count at 50% to 70% utilisation, plus zone redundancy.
- Say what the numbers imply: “4 million reads per second means counts come from cache”, “280 Gbps egress means a CDN”.
Step 8 is the one that earns credit. An estimate nobody uses is wasted time.
Interview angle
Interview questions
Q1: Your service handles 2,000 requests per second with a mean latency of 50 ms and a p99 of 800 ms. How many requests are in flight on average, and how would you size the thread pool?
By Little’s law with the mean, L = 2,000 x 0.05 = 100 requests in flight on average. Using the p99 (which would give 1,600) is wrong, because Little’s law relates averages. For the pool, start from the mean and add headroom for fluctuation and for latency spikes: something like 150 to 200 threads across the instances, or switch to async I/O so idle waits do not consume threads. Then check the downstream: if each request holds a database connection for part of its life, size that pool from the time the connection is actually held, not from the full request time.
Q2: Estimate the storage needed for one year of a service that logs 1 million events per second at 200 bytes each, kept with replication factor 3.
1,000,000 x 200 bytes = 200 MB/s. A day is 86,400 s, so 200 MB x 86,400 = about 17 TB per day. A year is about 6.3 PB raw, about 19 PB with 3 replicas. The conclusion is that a year of raw retention is expensive: compress (log data often compresses 5x to 10x), keep full detail for days or weeks, roll up older data, and move cold data to object storage with erasure coding instead of 3x replication.
Q3: How many servers do you need for 50,000 requests per second if each request uses 10 ms of CPU and servers have 32 cores?
One server saturates at 32 / 0.01 = 3,200 requests per second. At a 60% target, about 1,900. 50,000 / 1,900 = 26.3, so 27 servers for capacity. To survive the loss of one of three zones, provision 1.5x: 27 x 1.5 = 40.5, so 14 per zone, 42 in total. State the 60% target as an assumption, because latency rises sharply as utilisation approaches 100%.
✅ Key takeaways
- The pipeline is always DAU to events per day, divide by about 100,000 seconds, multiply by a peak factor, then multiply by sizes and latencies.
- Treat powers of two and ten as equal, but never confuse bits and bytes: 1 Gbps is 125 MB/s.
- Real storage is the payload times replication, indexes, derived copies and retention, often 5x to 10x the raw data.
- Little’s law, L = lambda x W, gives concurrency, pool sizes and concurrent users. It uses mean latency, not p99.
- Size servers for peak at 50% to 70% utilisation, then add enough to lose a zone.
- Always finish with what the numbers imply for the design.
🧠 Check your understanding
0 / 4-
1A service receives 864 million requests per day, spread evenly. What is the average QPS?
864,000,000 / 86,400 = 10,000 requests per second. Dividing by 864,000 by mistake gives 1,000; it is an easy slip when counting zeros.
-
2A service serves 20,000 responses per second averaging 50 KB. What egress bandwidth does it need?
20,000 x 50 KB = 1 GB per second, and 1 GB per second x 8 bits = 8 Gbps. Treating 1 GB per second as 1 Gbps is the classic bits versus bytes mistake and is off by 8x.
-
3An API serves 4,000 requests per second. Mean latency is 25 ms and p99 is 400 ms. How many requests are in flight on average?
Little's law uses the mean: 4,000 x 0.025 = 100. Using the p99 gives 1,600, which overestimates by 16x and leads to oversized pools.
-
4You need 9 servers of capacity at peak, spread across 3 availability zones, and must survive losing one zone. How many do you provision?
Losing a zone removes one third of the fleet, so the remaining two thirds must carry the full load: 9 x 1.5 = 13.5, round up to 14 (about 5 per zone). Provisioning 10 only covers losing a single server, not a zone.
Where to go next
- Latency numbers every engineer should know: the latency side of estimation, so you can tell whether a design can meet its target.
- Latency vs throughput: why W in Little’s law grows as utilisation rises, and why tail latency matters.
- Autoscaling and capacity planning: turning these estimates into fleets that grow and shrink with load.
- Design a URL shortener: a capstone where the estimate drives the key choices.
Finished this lesson?
Mark it complete to track your progress across the roadmap.