LearnastraTHE DESIGN COURSE

Think like a designer / CHAPTER 04

Back-of-the-envelope estimation

Estimate traffic, storage, and bandwidth using explicit assumptions and consistent units.

Beginner1h of deliberate study10 questions

Builds on Functional and non-functional requirements.

By the end, you can
  • Calculate average and assumed peak request rates.
  • Separate logical storage from replication and indexing.
  • Use estimates to choose a design action.

01Choose the question before the arithmetic

A note service must save new notes, keep them for a year and answer reads. Calculate the quantities that change those decisions:

  • Count writes to estimate how much saving work arrives each second.
  • Count retained bytes to plan storage.
  • Count repeated reads to decide whether reusable copies could save work.
  • Count attachments separately if a few files are much larger than notes.

Use these exercise assumptions:

  1. Two million people use the service each day.
  2. Each creates four notes/day.
  3. Each note, including required metadata, averages 2 KB.
  4. Notes are retained for 365 days.
  5. Busy-period traffic is assumed to be five times the daily average.

State units before calculating. Here 1 KB is 1,000 bytes, 1 GB is one billion bytes and 1 TB is one trillion bytes. Binary units such as mebibytes use a different convention.

Assumptions are not measurements. An average 2 KB record can hide large attachments, and a fivefold peak must be checked against real traffic before provisioning. Keep each input beside its calculation so another engineer can change it.

02Carry one workload through the units

Calculate writes and text storage separately:

  1. **Daily writes:**2 million users ×4 notes =8 million writes/day.
  2. **Average rate:**8 million ÷86,400 seconds ≈92.6 writes/second.
  3. **Planning peak:**92.6 ×5 ≈463 writes/second; rounding to about 465 is reasonable for planning.
  4. **Daily text:**8 million ×2,000 bytes =16 GB/day.
  5. **Annual text:**16 GB ×365 =5.84 TB.
  6. **Three full text copies:**5.84 TB ×3 =17.52 TB before supporting structures and spare space.

A note write may also check ownership, update an index and wait for copies to be saved. Measure that complete operation before converting requests/second into a machine count.

Now calculate an assumed ten reads per write:

  1. Eight million writes ×10 =80 million reads/day.
  2. Divide by 86,400 to get about 926 reads/second.
  3. At 2 KB/read, average body transfer is about 1.85 MB/second before network-format overhead.

Finally, suppose 1% of writes include a 5 MB image:

  1. Eight million ×1% =80,000 images/day.
  2. Multiply by 5 MB to obtain 400 GB/day.
  3. Compare 400 GB of images with 16 GB of note text. The image path carries 25 times as many new bytes.

Plan image transfer and storage separately from small note records. The calculation explains that choice without requiring a complicated identifier or partitioning scheme.

03Check concurrency, headroom, and uncertainty

Start storage planning with application records, then add what the chosen system actually retains:

  • Replicas keep additional current copies.
  • Indexes add structures used to find records.
  • Recovery logs retain changes needed after failures.
  • Backups retain earlier recoverable history under their own retention rule.
  • Compression may reduce stored bytes; metadata and spare capacity add more.

Do not replace those separate estimates with an unexplained universal multiplier.

Next distinguish arrival rate from simultaneous work. If 500 requests arrive each second and spend 0.2 seconds in the system on average, a stable system has about 500 × 0.2 = 100 requests being handled or waiting. This is average concurrency. Use the same start/end points for both measurements. It does not calculate p99 and does not make an endlessly growing queue stable.

Check one failure using surviving capacity:

  1. Four machines share 1,200 requests/second, so each receives 300/second while all are healthy.
  2. Lose one machine without changing demand. Each of three survivors receives 400/second.
  3. If testing found that a machine meets the latency target only up to 350/second, this fleet cannot safely cover the failure at that load.

Finish with the consequence and next evidence:

  • Images dominate bytes, so size their transfer and storage separately.
  • A modest write count alone does not prove a need for many database shards.
  • Measure the busiest users, record sizes, complete query work and peak shape.
  • If an input range gives the same conclusion, use that conclusion and measure the uncertain value next.

Follow the units, then choose the path

Follow the units, then choose the pathKeep requests and bytes separate. Calculate the rare large-object workload. Use the dominant cost to choose the next design investigation. Numbered arrows correspond to the connection key below. All connections are directional.2M users × 48M note writes/dayDivide by 86,400≈93/s average; assume5× peakText bytes16 GB/day at 2KB/noteAttachment bytes1% × 5 MB → 400GB/dayPhysical budgetCopies and overheadnamed separatelySeparate bytepathAttachments dominatestorage123456Follow the units, then choose the pathKeep requests and bytes separate. Calculate the rare large-object workload. Use the dominant cost to choose the next design investigation. Numbered arrows correspond to the connection key below. All connections are directional.2M users × 48M note writes/dayDivide by 86,400≈93/s average; assume5× peakText bytes16 GB/day at 2KB/noteAttachment bytes1% × 5 MB → 400GB/dayPhysical budgetCopies and overheadnamed separatelySeparate bytepathAttachments dominatestorage123456Follow the units, then choose the pathKeep requests and bytes separate. Calculate the rare large-object workload. Use the dominant cost to choose the next design investigation. Numbered arrows correspond to the connection key below. All connections are directional.2M users × 48M note writes/dayDivide by 86,400≈93/s average; assume5× peakText bytes16 GB/day at 2KB/noteAttachment bytes1% × 5 MB → 400GB/dayPhysical budgetCopies and overheadnamed separatelySeparate bytepathAttachments dominatestorage123456

Follow the numbered arrows

  1. 2M users × 4 → Divide by 86,400convert operations to rate
  2. 2M users × 4 → Text bytesmultiply by note bytes
  3. 2M users × 4 → Attachment bytesapply attachment fraction
  4. Text bytes → Physical budgetinclude retained text
  5. Attachment bytes → Physical budgetinclude retained objects
  6. Physical budget → Separate byte pathcompare dominant costs
Calculate text and images separately. The example adds 400 GB/day of images versus 16 GB/day of text, which explains why image storage and transfer need their own capacity plan.
Trace the diagram in words
  1. Keep requests and bytes separate.
  2. Calculate the rare large-object workload.
  3. Use the dominant cost to choose the next design investigation.

DRAW. CALCULATE. EXPLAIN.

Size a bookmark service with attachments

20 minutes · guided practice

Assume 5 million users save 2 bookmarks/day at 1 KB each. One half of one percent include a 4 MB snapshot. Retain data for 365 days and assume a sixfold traffic peak.

  1. Calculate average and peak writes/second.
  2. Calculate annual text and daily snapshot bytes.
  3. Explain which storage decision the numbers support.
Your self-check
Compare the worked solution
  1. Calculate 5 million ×2 =10 million writes/day. Divide by 86,400 to get about 116/second, then apply the assumed sixfold peak to get about 696/second.
  2. Text adds 10 million ×1 KB =10 GB/day, or 3.65 TB/year.
  3. Snapshots number 10 million ×0.5% =50,000/day. At 4 MB each, they add 200 GB/day or 73 TB/year before copies and other storage.
  4. Plan snapshot transfer and storage separately because its bytes dominate the text.
  5. Three full text copies require 10.95 TB. The snapshot store needs its own stated failure protection and copy calculation; that text number does not describe it.

The checkboxes record your own assessment. The worked solution gives you a way to check the reasoning.

RETRIEVE BEFORE YOU REVEAL

Keep the important ideas.

Say the answer aloud, then turn the card over.

CARD 01How do I estimate traffic?
  1. Multiply daily users by operations per user.
  2. Divide by 86,400 for average operations per second.
  3. Apply a separately stated peak assumption.
  4. Measure actual request work before turning the rate into a machine count.
CARD 02What belongs in storage planning?
  1. Calculate record and attachment bytes.
  2. Count the actual retained copies.
  3. Add indexes, logs, backup history, and spare space separately.

A small percentage of large attachments can store more bytes than all text records.

CARD 03How do I check survivor capacity?
  1. Keep peak demand unchanged after the named failure.
  2. Divide it across surviving machines.
  3. Compare with tested capacity at the response-time target.
  4. Allow for uneven work, retries, and shared dependencies.
Practise this topic in the revision deck ↗

CHECK THE REASONING

Can you explain the choice?

Answer every question, then finish for an immediate score and an explanation for each answer. Aim for 80%, then revisit any gaps.

1 / 10Assume 8 million writes/day. What is the average rate?
2 / 10The average is 93/s and the planning peak factor is 5. What should you report?
3 / 10Assume 8 million records/day at 2 KB. What is daily logical growth in decimal units?
4 / 10Three replicas of 5.84 TB logical data require what before other overhead?
5 / 101% of 8 million writes attach 5 MB. What is the attachment growth?
6 / 10Under stable conditions, at 500 requests/s and 0.2 seconds average response time, what is average work in flight?
7 / 10Four instances share 1,200/s; one fails. What does each survivor receive if evenly balanced?
8 / 10Which estimate most directly affects the photo-byte path?
9 / 10Why not multiply logical bytes by an unexplained universal overhead factor?
10 / 10An estimate ranges widely but both ends exceed the current storage budget. What should you do?
0 of 10 answered

CLOSE THE LOOP

Explain it without the page.

Summarise the mechanism, one trade-off, and one failure mode. Then mark this chapter complete.