TweakCode
Design Method lessons

Estimation · Stage 1 of 3

Back-of-the-Envelope Rates & Storage

Convert monthly product numbers into per-second rates and total bytes

Foundations

Estimation turns product numbers into the units machines are judged by: requests per second and bytes stored. A month has about 2.6 million seconds, so a monthly count divided by 2.6 million becomes a rate, and storage is rows times bytes per row times years kept. Compare each result with one machine: a database primary handles thousands of simple writes per second, and one large disk holds a few terabytes.

Keep reads and writes apart, because their ratio decides the next component: a read-heavy service wants a cache, and a write-heavy one wants a faster or split store. Write the unit beside every number. Comparing a monthly total with a per-second limit is the classic estimation mistake.

Take a service that stores 10 million new records a month, reads each 20 times, keeps them 3 years, and uses 1 KB per record. Writes are about 10,000,000 / 2,600,000 ≈ 4 per second and reads about 77. Storage is 10M × 36 months × 1 KB = 360 GB. Every number fits one machine, so nothing here forces sharding.

requestsUsersService4 writes/s · 77 reads/sStore360 GB
The service carries the rates and the store carries the size, each in its own unit. Next to one machine's limits, all three numbers are small, so the verdict is one primary.
  • Requirements

    Estimates and APIs start from an agreed list of what the system must do.

    Open lesson

Case Scenario

The design brief

Size a URL shortener

Assume 100 million new short links a month and ten redirects per new link. Keep the data for five years. A mapping row is about 500 bytes.

Input
links_per_month = 100_000_000, reads_per_link = 10, row_bytes = 500, years = 5
Output
[39, 386, 3000]

To see how estimation turns monthly totals into machine-sized numbers, consider a URL shortener like bit.ly with 100 million new short links a month, ten redirects per link, and 500-byte mapping rows kept for five years. That is about 39 writes and 386 reads per second, and 3 TB of rows.

“100 million” sounds huge until units show whether it creates a traffic problem or only a storage problem. The same shortener can be quiet on creates and heavy on redirects, while viral links can turn a 10:1 read ratio into 1000:1. The estimate must decide whether one primary absorbs creates and what cache hit rate keeps redirect reads within its capacity.

Pro

The rest of this is on Pro

The idea above is free. The walkthrough, the cost, and the practice are on Pro.