Back-of-the-envelope estimation is quick, rough arithmetic that tells you which architecture you need before you build it. Does the data fit on one machine? Does the hot set fit in memory? Is it 50 requests per second or 50,000? Getting within a factor of 2 to 10 is enough, because those answers decide between a single database and a sharded cluster. This lesson gives you the reference numbers, the formulas, and a full worked example.
Think of it like
Planning a road trip
You don't need the exact mileage to know whether a trip needs one tank of fuel or three, whether you can drive it in a day, or whether to book a hotel. Rough numbers (distance, speed, tank size) are enough to make the decisions that matter. Estimation does the same for systems: rough users, requests and bytes tell you how many servers, how much storage and where the bottleneck will be.
Why estimate at all?
- Pick the architecture: 100 writes/s fits on one PostgreSQL primary; 100,000 writes/s needs Sharding & Partitioning or a write-optimized store.
- Size the cache: if the hot data is 50 GB, one Redis node holds it; if it is 5 TB, you need a cluster. See Caching.
- Choose storage: petabytes of media belong in Blob & Object Storage behind a Content Delivery Networks, not in a database.
- Find the bottleneck early: bandwidth, disk, memory or CPU. The largest number usually tells you where to spend design effort.
- Interviews: a quick, well-reasoned estimate shows you design for real constraints rather than in a vacuum.
Latency numbers every engineer should know
These figures, popularized by Jeff Dean and Peter Norvig, are dated and hardware varies, but the orders of magnitude still hold and are what you should memorize. Use the calculator above to plug them into your own estimates.
| Operation | Time | Relative to a memory reference |
|---|---|---|
| L1 cache reference | 0.5 ns | 1/200× |
| Branch mispredict | 5 ns | 1/20× |
| L2 cache reference | 7 ns | 1/14× |
| Mutex lock/unlock | 25 ns | 1/4× |
| Main memory reference | 100 ns | 1× |
| Compress 1 KB with Snappy | 3 µs | 30× |
| Send 1 KB over a 1 Gbps network | 10 µs | 100× |
| Read 4 KB randomly from SSD | 150 µs | 1,500× |
| Read 1 MB sequentially from memory | 250 µs | 2,500× |
| Round trip within the same data center | 500 µs | 5,000× |
| Read 1 MB sequentially from SSD | 1 ms | 10,000× |
| Disk seek (spinning HDD) | 10 ms | 100,000× |
| Read 1 MB sequentially from HDD | 20 ms | 200,000× |
| Packet round trip California → Netherlands → California | 150 ms | 1,500,000× |
Powers of two and data sizes
| Power | Exact value | Approximation | Unit |
|---|---|---|---|
| 2¹⁰ | 1,024 | 1 thousand (10³) | 1 KB |
| 2²⁰ | 1,048,576 | 1 million (10⁶) | 1 MB |
| 2³⁰ | 1,073,741,824 | 1 billion (10⁹) | 1 GB |
| 2⁴⁰ | ≈ 1.1 × 10¹² | 1 trillion (10¹²) | 1 TB |
| 2⁵⁰ | ≈ 1.13 × 10¹⁵ | 1 quadrillion (10¹⁵) | 1 PB |
| Item | Typical size |
|---|---|
| ASCII character | 1 byte (UTF-8 non-Latin: 2 to 4 bytes) |
| Integer / long / timestamp | 4 bytes / 8 bytes / 8 bytes |
| UUID | 16 bytes (36 as a string) |
| Short text post with metadata | ~500 bytes to 1 KB |
| Compressed web photo | ~200 KB to 2 MB |
| 1 minute of 1080p video at 5 Mbps | ~40 MB |
Time conversions
The single most useful shortcut: a day has 86,400 seconds, call it 10⁵. It turns "per day" into "per second" by dropping five zeros (and slightly underestimates, which you can mention).
| Per day | ≈ per second | Exact |
|---|---|---|
| 1 million | ~10 | 11.6 |
| 10 million | ~100 | 116 |
| 100 million | ~1,000 | 1,157 |
| 1 billion | ~10,000 | 11,574 |
| 10 billion | ~100,000 | 115,741 |
- 1 day
- 86,400 s ≈ 10⁵ s
- 1 month
- ≈ 2.6 million s ≈ 2.5 × 10⁶ s
- 1 year
- ≈ 31.5 million s ≈ 3 × 10⁷ s (also: π × 10⁷)
The core formulas
| Component | Rough capacity per node | Notes |
|---|---|---|
| Stateless app server | 1,000 to 10,000 req/s | Highly workload-dependent; measure yours |
| Redis / Memcached | ~100,000+ ops/s | Sub-millisecond, memory-bound |
| Relational DB (indexed reads) | ~10,000 simple queries/s | Writes and complex joins are far lower |
| Kafka broker | ~100s of MB/s | Sequential disk I/O |
| Network interface | 10 to 25 Gbps | ≈ 1.25 to 3 GB/s |
Worked example: a Twitter-like service
Let's estimate a microblogging service end to end. The point is not the exact numbers but the habit: state each assumption, compute, round, and note what each result means for the design.
| Assumption | Value |
|---|---|
| Daily active users (DAU) | 200 million |
| Posts per user per day | 0.5 → 100 million posts/day |
| Timeline loads per user per day | 20 → 4 billion loads/day |
| Posts shown per timeline load | 20 |
| Size of a post (text + metadata) | ~500 bytes |
| Posts with media | 10%, averaging 1 MB |
| Peak factor | 3× |
| Retention / replication | 5 years / 3 copies of metadata |
- 1
Write QPS
100M posts ÷ 10⁵ s ≈ 1,000 posts/s on average, ~3,000/s at peak. One well-provisioned database primary could absorb this, but fan-out to followers multiplies the real write load.
- 2
Read QPS
4B timeline loads ÷ 10⁵ s ≈ 40,000/s on average, ~120,000/s at peak. Reads outnumber writes 40:1 by request and 800:1 by posts delivered (4B × 20 ÷ 100M). This is a read-heavy system: precompute timelines and cache aggressively.
- 3
Metadata storage
100M × 500 B = 50 GB/day → ~18 TB/year → ~90 TB over 5 years → ~270 TB with 3 replicas. Too much for one database: partition by user or post ID.
- 4
Media storage
10M media posts/day × 1 MB = 10 TB/day → ~3.7 PB/year. This belongs in object storage, never in the database.
- 5
Bandwidth
Media ingress: 10 TB ÷ 10⁵ s ≈ 100 MB/s (~0.8 Gbps). Timeline egress (text): 40,000 × 20 × 500 B = 400 MB/s (~3.2 Gbps). Media egress, if each load shows two 100 KB thumbnails: 40,000 × 200 KB = 8 GB/s (~64 Gbps): CDN territory.
- 6
Cache
Precomputed timelines of ~800 post IDs × 8 B for all 200M DAU = ~1.3 TB of RAM → about 20 nodes with 64 GB usable each, before replication.
- 7
App servers
~120,000 peak timeline requests/s ÷ ~1,000 per server ≈ 120 servers; with 30% headroom, ~150 servers.
Write QPS
~1k /s
Peak ~3k/s
Read QPS
~40k /s
Peak ~120k/s
Read : write
40 : 1
800 : 1 counting posts delivered
App servers
~150
120k ÷ 1k per server × 1.3
Metadata
~270 TB
50 GB/day × 5 yrs × 3 replicas
Media
~3.7 PB/yr
10 TB/day into object storage
Media egress
~64 Gbps
Served by a CDN
Timeline cache
~1.3 TB
200M × 800 IDs × 8 B
Tips for fast, credible estimates
- Round aggressively. 86,400 becomes 10⁵, 2.6 million seconds becomes 2.5 × 10⁶, 1,157 becomes 1,000. Precision wastes time and hides the point.
- State assumptions out loud and write them down. The interviewer can correct an assumption; they cannot correct a hidden one.
- Use scientific notation for big multiplications: 2 × 10⁸ users × 5 × 10² bytes = 10 × 10¹⁰ = 10¹¹ bytes = 100 GB.
- Label units at every step (per day vs per second, bits vs bytes: 1 Gbps ≈ 125 MB/s).
- Estimate peak, not just average, and add replication and overhead factors where they change the conclusion.
- Sanity-check against known systems: if your chat app needs more servers than Google, re-check a zero.
- Only compute what matters. If storage is obviously small, say so and move on.
Implementation
Encodes the formulas above so you can tweak assumptions and see the effect. It uses the exact 86,400 s/day, so results run about 15% higher than the 10⁵ shortcut.
from dataclasses import dataclass
SECONDS_PER_DAY = 86_400
UNITS = ((10**15, "P"), (10**12, "T"), (10**9, "G"), (10**6, "M"), (10**3, "k"))
def human(n: float, unit: str) -> str:
for factor, prefix in UNITS:
if n >= factor:
return f"{n / factor:.1f} {prefix}{unit}"
return f"{n:.0f} {unit}"
@dataclass
class Workload:
dau: int
writes_per_user_per_day: float
reads_per_user_per_day: float
bytes_per_write: int
bytes_per_read: int
peak_factor: float = 3.0
retention_years: int = 5
replication: int = 3
def estimate(w: Workload) -> dict[str, str]:
write_qps = w.dau * w.writes_per_user_per_day / SECONDS_PER_DAY
read_qps = w.dau * w.reads_per_user_per_day / SECONDS_PER_DAY
per_day = w.dau * w.writes_per_user_per_day * w.bytes_per_write
total = per_day * 365 * w.retention_years * w.replication
return {
"write QPS avg / peak": f"{write_qps:,.0f} / {write_qps * w.peak_factor:,.0f}",
"read QPS avg / peak": f"{read_qps:,.0f} / {read_qps * w.peak_factor:,.0f}",
"new data per day": human(per_day, "B"),
"total storage": human(total, "B"),
"read egress avg": human(read_qps * w.bytes_per_read, "B/s"),
}
twitter_like = Workload(
dau=200_000_000,
writes_per_user_per_day=0.5,
reads_per_user_per_day=20,
bytes_per_write=500,
bytes_per_read=20 * 500, # 20 posts per timeline load
)
for name, value in estimate(twitter_like).items():
print(f"{name:<22} {value}")
# write QPS avg / peak 1,157 / 3,472
# read QPS avg / peak 46,296 / 138,889
# new data per day 50.0 GB
# total storage 273.8 TB
# read egress avg 463.0 MB/sKey takeaways
- Estimation exists to make decisions: one database or many, cache size, CDN or not, how many servers.
- Memorize orders of magnitude: memory ~100 ns, SSD random read ~100 µs, data center round trip ~0.5 ms, disk seek ~10 ms, cross-continent ~150 ms.
- A day is about 10⁵ seconds, so 1 million per day is about 10 per second.
- QPS = DAU × actions ÷ 86,400, then multiply by a peak factor; storage = items × size × retention × replication.
- Round aggressively, state assumptions, label units and finish every number with the design decision it implies.
Common pitfalls
- Designing for the average load and falling over at the daily peak or during an event.
- Confusing bits and bytes (a 1 Gbps link moves about 125 MB/s, not 1 GB/s).
- Forgetting replication, indexes and media when estimating storage.
- Spending ten minutes on precise arithmetic that does not change any decision.
- Treating per-server capacity figures as facts instead of stated assumptions.
Interview tips
- Narrate the shortcut: "100 million a day over 10⁵ seconds is about a thousand per second."
- Write assumptions in a corner of the whiteboard and refer back to them when justifying design choices.
- Finish with the two or three numbers that drive the design (peak QPS, total storage, egress) and what they imply.
Real-world applications
- Capacity planning and budgeting for new services.
- Deciding when to shard, add a cache tier or move media to object storage plus a CDN.
- Sanity-checking load-test results and cloud cost forecasts.
Test yourself
A service handles 500 million requests per day. What is the average QPS, roughly?
Related topics
Finished this lesson? Track it to see your progress on the roadmap.