Sub topic 2
Stating Assumptions and Rounding to Keep Math Simple
This chapter assumes you are comfortable with powers of ten, basic client-server architecture, and what a database, cache and load balancer do. Reading simple Python helps but is optional.
Why assumptions come first
Every estimate starts from numbers nobody gave you. A requirement such as "support ten million users" does not say how often each user acts, how large each record is, or how long data is kept. You fill these gaps with assumptions. Write each one down before you calculate.
Stated assumptions do three things:
- They let a reviewer check your reasoning instead of arguing about your answer.
- They show which input drives the result, so you know what to refine first.
- They make the estimate easy to redo when a number changes.
A good assumption has a name, a value, and a unit. "Each user makes 10 requests per day" is usable. "Users are fairly active" is not.
Choosing round numbers
The goal is the right order of magnitude, not the right digit. Choose inputs that multiply easily.
| Exact figure | Rounded figure | Why |
|---|---|---|
| 86,400 seconds per day | about 100,000 (10^5) | Quick mental division |
| 9,640,000 users | 10 million (10^7) | One significant digit |
| 487 bytes per record | 500 bytes | Easy to multiply |
| 1.157 thousand QPS | about 1,000 | Order of magnitude is what matters |
Keep one or two significant digits. Round the inputs, not the final answer, so every step stays easy to check. When you round, try to alternate directions so errors cancel. If you round one input up, it is fine to round another down.
A worked example
Suppose a service has 10 million daily active users (DAU), and each user makes 10 requests per day. The assumptions are:
- DAU is 10,000,000.
- Each user makes 10 requests per day.
- A day has 86,400 seconds.
- Peak load is twice the average.
The Python below applies them exactly.
dau = 10_000_000
requests_per_user_per_day = 10
seconds_per_day = 86_400
peak_factor = 2
avg_qps = dau * requests_per_user_per_day / seconds_per_day
peak_qps = avg_qps * peak_factor
print(round(avg_qps)) # 1157
print(round(peak_qps)) # 2315Now do the same by hand with rounding. Total requests per day is 10^7 × 10 = 10^8. Using 10^5 seconds per day, average QPS is 10^8 / 10^5 = 1,000. Peak is about 2,000. The exact answers are 1,157 and 2,315. The hand estimate is within about 15 percent, which is close enough to choose between "one server" and "a thousand servers".
Common errors
- Hidden assumptions. If you use a peak factor of 2 but never say so, the reader cannot tell why your number differs from theirs.
- Too much precision. Reporting 1,157.4 QPS implies accuracy your inputs do not have. Say "about 1,000".
- Rounding the output only. Rounding at the end hides which step introduced error.
- Mixed units. Bytes and bits, or per-day and per-second, are easy to mix. Write the unit next to every number.
- Biased rounding. Always rounding down makes a system look cheaper than it is. When unsure, round up for capacity.
Exercise
A service has 50 million DAU and each user makes 20 requests per day. State your assumptions, round 86,400 to 10^5, and estimate average QPS. By how much does the rounded result differ from the exact one?
Show answer
Total requests per day is 5 × 10^7 × 20 = 10^9. Dividing by 10^5 gives about 10,000 QPS. Exactly, 10^9 / 86,400 is about 11,574 QPS. The rounded result is about 14 percent low, which is the same order of magnitude.