Sub topic 2
Stating Assumptions and Rounding to Keep Math Simple
This chapter assumes you know basic arithmetic with large numbers and exponents. It also assumes you know what a client, server, database and cache do. Reading simple Python helps, but is optional.
An estimate is only as good as the assumptions under it. This chapter shows how to state those assumptions, how to round so the arithmetic stays easy, and which errors come up most often.
Why assumptions come first
A system requirement is usually vague. "Support ten million users" does not say how often each user acts, how big each action is, or how long data must be kept. You have to supply those numbers. If you supply them silently, nobody can check your work and nobody can correct the one number that is wrong.
An assumption is a number or fact you choose because the requirement does not give it. A good assumption has three properties:
- It is explicit. It is written or said out loud, with units.
- It is plausible. A reasonable engineer would not call it absurd.
- It is adjustable. Changing it changes the result in a way you can predict.
The last property matters most. If the interviewer or product owner says "users are more active than that," you should be able to change one input and update the answer in seconds.
Kinds of inputs
Most estimates mix three kinds of input. Keeping them apart makes the work easier to review.
| Kind | Example | Who supplies it |
|---|---|---|
| Given | 10 million daily active users | The requirement |
| Assumed | 10 requests per user per day | You, stated aloud |
| Reference | 86,400 seconds in a day | Memorized constant |
Reference constants are covered in the next chapters. Here the focus is on the assumed inputs, because they cause most of the error.
A repeatable way to state assumptions
Use the same short routine each time.
- List the unknowns. Ask what the estimate needs: users, actions per user, size per action, retention, peak behavior.
- Pick a value for each. Choose a round, plausible number.
- Write the unit next to it. "500 bytes per record" is checkable. "500" is not.
- Mark the weak ones. Note which assumptions you are least sure of. These are the ones to revisit.
- Compute, then report the result with its assumptions. "About 1,200 average QPS, assuming 10 requests per user per day."
Reporting the result together with its assumptions is what makes it useful. A bare number cannot be debated. A number with its inputs can.
Example of a stated assumption block
Suppose you are sizing a note-taking service. A clear block looks like this:
- 10 million daily active users (given)
- 10 requests per user per day (assumed, read-heavy)
- 500 bytes per stored record (assumed, text plus metadata)
- Data kept for 5 years (assumed)
Four lines, each with a unit, each easy to challenge. The rest of the estimate is arithmetic on these lines.
Rounding to keep math simple
The goal is not an exact answer. The goal is the right order of magnitude, meaning the right power of ten. An answer of 1,200 and an answer of 1,157 lead to the same design. An answer of 12,000 does not.
Because of this, you should round aggressively at the start, so the arithmetic fits in your head.
Rules of thumb for rounding
- Round inputs, not just outputs. Replace 86,400 seconds per day with 100,000 when you need a fast mental check. The error is about 15%, which is small next to the uncertainty in the assumptions.
- Keep one or two significant digits. 1,157 becomes about 1,200, or even 1,000.
- Use powers of ten and simple multiples. Prefer 10 million to 9.7 million. Prefer 500 bytes to 487 bytes.
- Round in a direction you can name. When sizing capacity, rounding up is the safer error. Say so: "rounding up to 100,000."
- Do not round away the order of magnitude. Rounding 1.4 to 1 is fine. Rounding 0.4 million to 0 is not.
Scientific-style bookkeeping
Writing numbers as a coefficient and a power of ten keeps large products manageable. Multiply the coefficients, then add the exponents.
For 10 million users making 10 requests each per day:
- 10 million = 10^7
- 10 requests = 10^1
- Product: 10^8 requests per day
Divide by roughly 10^5 seconds per day, and you get about 10^3 requests per second. This takes a few seconds and gives the right magnitude. The precise figure, computed below, is 1,157.
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)) # 2315The mental shortcut of 10^3 and the exact 1,157 agree on the order of magnitude. Both say "about a thousand requests per second." The assumed peak factor of 2 is another stated assumption, and it should be written down like the others.
How much error does rounding add?
Rounding errors multiply when you chain steps, so it helps to see how large they get. Each row compares an exact value to the rounded one.
| Exact | Rounded | Error |
|---|---|---|
| 86,400 | 100,000 | about +16% |
| 86,400 | 90,000 | about +4% |
| 1,157 | 1,200 | about +4% |
| 91.25 | 100 | about +10% |
If you round three inputs up by 15% each, the result is about 50% high (1.15 cubed is about 1.52). That is still the same order of magnitude, so it usually does not change a design decision. The danger is not a 50% error. It is a factor-of-ten error, and those come from units and exponents, covered below.
Applying the routine to storage
Storage shows how assumptions and rounding work together. Suppose the service writes 100 million new records per day, each about 500 bytes, kept for 5 years.
Write the assumptions first:
- 100 million new records per day (assumed)
- 500 bytes per record (assumed)
- 5 years of retention, written as 365 × 5 days (assumed)
Then compute:
new_records_per_day = 100_000_000
bytes_per_record = 500
retention_days = 365 * 5
total_bytes = new_records_per_day * bytes_per_record * retention_days
print(total_bytes / 1e12) # 91.25 (terabytes, decimal units)By hand, round 365 × 5 = 1,825 days up to 2,000. Then 10^8 × 500 × 2,000 = 10^8 × 10^6 = 10^14 bytes, which is 100 TB. The exact answer is 91.25 TB. The rounded answer is about 10% high, and it leads to the same decision: you need tens of terabytes, so a single small disk will not do, and sharding or a distributed store becomes a real question.
The code uses decimal units (1 TB = 10^12 bytes). The next chapter covers powers of two and when the binary units differ. For estimation, the difference is about 10% at the terabyte scale, so state which one you use and keep it consistent.
Availability as an assumption
Targets can also be treated as inputs that you convert. An availability target such as 99.9% becomes allowed downtime once you fix the period.
minutes_per_year = 365 * 24 * 60
for availability in (99.9, 99.99):
downtime = (1 - availability / 100) * minutes_per_year
print(availability, round(downtime, 2))
# 99.9 525.6
# 99.99 52.56Each extra nine cuts allowed downtime by a factor of ten. Rounded, 99.9% allows about 9 hours per year, and 99.99% allows about 53 minutes. The assumption to state here is the period: per year, per month or per quarter give different minute counts.
Visualizing the workflow
The routine is a loop. Every weak assumption can send you back to an earlier step.
Common errors
Most wrong estimates come from a short list of mistakes.
Unit mismatches
Mixing bytes with bits, or seconds with days, creates factor-of-ten, factor-of-eight or factor-of-86,400 errors. Network bandwidth is often quoted in bits per second, while storage is quoted in bytes. Write the unit on every line, and check that units cancel the way you expect. For example, requests per day divided by seconds per day gives requests per second.
Hidden assumptions
If you use a peak factor of 2 but never say so, a reviewer may assume you used the average. Say each factor out loud: "I'm assuming peak is twice average."
False precision
Reporting 1,157.4 QPS implies you know the input to five digits. You do not. Report "about 1,200" or "roughly a thousand." Extra digits suggest accuracy that the assumptions cannot support.
Rounding the wrong way at the wrong time
Rounding down a capacity estimate can lead you to under-provision. Rounding up a cost estimate is usually safe but can make a design look too expensive. Pick the direction that matches the risk, and say which you chose.
Dropping a factor
Forgetting retention, replication or the peak factor is common. If your storage estimate ignores that data is stored on three replicas, the real number is three times larger. Check each estimate against the list of inputs you wrote down.
Putting it together
A solid estimate has this shape. It begins with a short list of given and assumed inputs, each with a unit. The calculation uses rounded numbers and powers of ten. The result is reported to one or two digits, together with the assumptions behind it. A reader can change any assumption and redo the math quickly.
Exercise
A chat service has 2 million daily active users. You assume each user sends 50 messages per day, each message is about 200 bytes, and messages are kept for 2 years. Write the assumptions, then estimate average messages per second (using 100,000 seconds per day) and total storage in terabytes (using 700 days for 2 years, rounded). State the direction of your rounding.
Show answer
Assumptions: 2 million DAU (given), 50 messages per user per day, 200 bytes per message, 2-year retention. Messages per day: 2 × 10^6 × 50 = 10^8. Average per second: 10^8 / 10^5 = 1,000 messages per second (the exact figure with 86,400 seconds is about 1,157, so rounding the day up to 100,000 rounds the rate down by about 14%). Storage: 10^8 messages per day × 200 bytes = 2 × 10^10 bytes per day. Over about 700 days, that is 1.4 × 10^13 bytes, or about 14 TB (the exact count is 730 days, which gives about 14.6 TB, so using 700 days rounds down). Both roundings are downward, so say the result is a slight underestimate, and round up before provisioning.
Exercise
A teammate writes "peak load is 5,000 QPS" with no other detail. Name three assumptions you would ask them to state before using the number in a design.
Show answer
Any three of: the number of daily active users, the number of requests per user per day, the peak factor used to go from average to peak, the period over which peak was measured, and whether the figure counts only reads or both reads and writes. Each one changes the result, and each can be wrong independently.