Module F-3·20 min read

QPS, storage, and bandwidth math built on real hardware numbers — sizing a system in five minutes without opening a spreadsheet.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

Module F-3 — Back-of-the-Envelope Estimation

What this module covers: How to size a system in five minutes, on paper, and be confident you're within an order of magnitude. This module covers the handful of constants worth memorising, the four calculations that cover most designs (QPS, storage, bandwidth, working set), peak-vs-average as the trap that catches everyone, the multipliers people forget — replication, indexes, overhead — and the per-component sanity anchors that let you say "that needs about six servers" without opening a spreadsheet. Built on the real hardware numbers from Module F-2, so the answers mean something.


The Point Is to Reject Designs Cheaply

Estimation isn't about being right. It's about being right enough, fast enough to throw out bad designs before anyone builds them.

Three examples of what that looks like:

  • Someone proposes keeping all user sessions in a single Redis instance. Thirty seconds of arithmetic: 50M sessions × 2 KB = 100 GB. That doesn't fit the instance type anyone was imagining, so either the session object shrinks, the TTL shortens, or you're running a Redis cluster. Decision made, before the design doc got written.
  • Someone proposes a nightly full export to a partner. 400M rows × 1.2 KB = ~480 GB, over a pipe that does ~100 MB/s, is ~80 minutes of continuous transfer — assuming nothing else uses the link. That's not impossible, but it's an hour-and-a-half batch window with an egress bill attached, which is a different conversation from "we'll just add an export job."
  • Someone worries a proposed feature will overwhelm the database. 200K daily users × 3 actions = 600K writes/day, which is ~7 writes/second average and maybe 50/second at peak. A single Postgres handles that without noticing. No design change needed — and that's a valuable estimate too, because it prevents unnecessary complexity.

Notice all three took under a minute and none of them needed precision. Being off by 30% changes nothing. Being off by 100× changes everything, and back-of-the-envelope math reliably catches the 100× errors.

Analogy: estimation is the weight limit sign on a bridge, not a bathroom scale. Nobody needs to know a truck's mass to the gram. They need to know whether it's in the 5-tonne class or the 50-tonne class, because one of those crosses and one doesn't.

Why this matters in production: the estimates that fail are almost never wrong because someone mis-multiplied. They're wrong because a multiplier was missing — nobody counted replication, or index size, or the peak-to-average ratio, or the fact that every write also produces a WAL record, a replica copy, and a backup copy. The arithmetic is trivial. The discipline is in the checklist.


The Constants Worth Memorising

Time. There are 86,400 seconds in a day. Round it to 100,000 — it's a 15% error in the safe direction and it turns every division into moving a decimal point.

QuantityUse
1 day ≈ 10⁵ secondsdaily total → QPS
1 month ≈ 2.6 × 10⁶ secondsmonthly totals, billing periods
1 year ≈ 3.2 × 10⁷ secondsretention and growth

Sizes. Powers of two, rounded to powers of ten:

UnitBytesSanity anchor
1 KB10³a small JSON record, a tweet with metadata
1 MB10⁶a compressed photo, ~1,000 small records
1 GB10⁹a small table, a container's memory allowance
1 TB10¹²a healthy production Postgres
1 PB10¹⁵a data lake

Typical object sizes — worth having rough figures for, because storage estimates are only as good as these:

  • An integer or timestamp column: 4–8 bytes
  • A UUID: 16 bytes binary, 36 as text (a detail that matters at scale — Module P-3)
  • A short text row (user, order line, event): 100 B – 1 KB
  • A JSON API response: 1–10 KB
  • A compressed web image: 100 KB – 1 MB
  • A minute of 1080p video: ~50 MB

Latency, from Module F-2: memory ~100 ns, SSD read ~50 µs, same-datacentre round trip ~0.5 ms, cross-continent ~180 ms.


The Four Calculations

1. QPS: from users to requests per second

text

The peak factor is where estimates live or die. Traffic is never flat — it follows waking hours, working hours, and events. Reasonable defaults:

Traffic shapePeak factorExample
Global consumer app, always-on2–3×messaging, social
Single-country consumer app3–5×domestic e-commerce, food delivery
Business-hours internal tool5–10×payroll, admin dashboards (idle 16 hours a day)
Event-driven or campaign-driven10–100×ticket sales, flash sales, push-notification fan-out

You must design for peak, not average. A system sized for average QPS is a system that falls over every day at 8pm. And the last row is not hyperbole: a push notification sent to two million users generates its entire load inside about a minute, which is why Module F-1's notification example concluded "queue it" before any code was written.

Worked example — a photo-sharing app:

text

That read/write ratio is one of Module F-1's four numbers, and it fell out of the estimate for free.

2. Storage: how much, and for how long

text

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.