Skip to content

Part 1 · Blueprint 01

Back-of-Envelope Capacity Estimation

16 min reading · Sources · Editorial review pending

Average traffic hides simultaneous demand; count each component's work separately.

More
20px
Reading list
Page details

Published date · Last edited:

Draft edition. Editorial review and supplementary reading recommendations are still being completed.

Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: none beyond the bootcamp.

Sixty-second mental model

Problem: Average traffic hides simultaneous demand; count each component's work separately.

Use: Measure a representative action before buying capacity.

Design boundary: Estimate a hypothetical document service. Count reads, mutations and retained objects separately; do not size storage from every HTTP request. A successful estimate ends in a capacity decision rather than a large byte total.

Layer 1 · Intuition

Hypothetical scenario: Northwind is designing capacity estimation. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one user action means and which component owns the workload model.

Think of a shop planning tills before opening. Separate the requester from workload model, then identify the retained evidence needed after failure.

Authority
The entitled state owner.
Invariant
A rule preserved across concurrency and failures.
Bandwidth
A data transfer rate or capacity, expressed in bits or bytes per unit time. Analogy: The amount of material a delivery lane can carry per second.
Bit
A binary information unit with two possible values. Analogy: One switch that is off or on.
Byte
An information unit conventionally comprising eight bits. Analogy: A bundle of eight switches.
DAU
Daily active users under a stated definition of activity. Analogy: The distinct visitors who did the counted action today.
MAU
Monthly active users under a stated definition of activity. Analogy: The distinct visitors who did the counted action this month.

Architecture and worked reasoning

Design boundary: Estimate a hypothetical document service. Count reads, mutations and retained objects separately; do not size storage from every HTTP request. A successful estimate ends in a capacity decision rather than a large byte total.

Responsibilities on the request path

Capacity estimation: responsibilities and request directionEstimate a hypothetical document service. Count reads, mutations and retained objects separately; do not size storage from every HTTP request. A successful estimate ends in a capacity decision rather than a large byte total.ReadersAPI poolDocument databaseObject storage
Estimate a hypothetical document service. Count reads, mutations and retained objects separately; do not size storage from every HTTP request. A successful estimate ends in a capacity decision rather than a large byte total.

Workload and limiting resource

Choose 100,000 daily users making 20 reads each: 100,000 × 20 = 2,000,000 reads/day. Average is 2,000,000 / 86,400 = 23.15 reads/s approximately; a chosen 5× peak is 115.74 reads/s. At a hypothetical tested budget of 80 reads/s per server, three servers leave two survivors with 160 reads/s. This says nothing about database capacity until that resource is separately bounded.

Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.

Mutation or publication path

Capacity estimation: mutation boundaryChoose active users and operations per user before selecting a peak multiplier. Then: Count logical reads separately from retry attempts. Then: Identify the resource that the busiest operation consumes.Step 1
Choose active users and operations per user before selecting a peak multiplier.
Step 2
Count logical reads separately from retry attempts.
Step 3
Identify the resource that the busiest operation consumes.
Choose active users and operations per user before selecting a peak multiplier. Then: Count logical reads separately from retry attempts. Then: Identify the resource that the busiest operation consumes.
  1. Choose active users and operations per user before selecting a peak multiplier.
  2. Count logical reads separately from retry attempts.
  3. Identify the resource that the busiest operation consumes.

Observation and recovery path

Capacity estimation: observation boundaryTrace the dominant query to its index and payload. Then: Determine whether cache hits avoid database work. Then: Check that the remaining database traffic fits the survivor budget.Step 1
Trace the dominant query to its index and payload.
Step 2
Determine whether cache hits avoid database work.
Step 3
Check that the remaining database traffic fits the survivor budget.
Trace the dominant query to its index and payload. Then: Determine whether cache hits avoid database work. Then: Check that the remaining database traffic fits the survivor budget.
  1. Trace the dominant query to its index and payload.
  2. Determine whether cache hits avoid database work.
  3. Check that the remaining database traffic fits the survivor budget.

Failure that changes the decision

Hypothetical scenario: A popular document concentrates reads on one key. Aggregate CPU can remain low while its shard saturates; test the busiest key and the selected cache-miss path.

Attempt this decision before reading the explanation

A 90% cache hit rate is measured during normal traffic. Can the database be sized for only 10% of peak?

Only if the miss behavior and cold-start policy justify that assumption. A restart, skew shift or synchronized expiry can send far more traffic to storage. Bound cold misses and test recovery rather than treating the normal hit ratio as an availability guarantee.

Supporting mechanism analysis

Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.

Hypothetical scenario. At Northwind, Maya emails 120,000 subscribers. Dev models the clicks before the promotion starts.

In short. Derive peaks from an explicit arrival window. Keep peak assumptions separate from measured traffic.

Hypothetical scenario. A catalogue service lets people read item descriptions and update listings. Before choosing machines, a designer needs to understand the demand: how many reads arrive, how large their responses are, how much new data is retained, and what happens when a cache cannot answer.

The purpose of capacity estimation is to expose a design's assumptions and likely constraints. It does not produce a trustworthy server count from a user count alone. Two applications with the same audience can have different request mixes, response sizes, data retention and computational work. An estimate becomes useful when another engineer can change an assumption and follow its consequences.

A daily average also hides when work arrives. Dividing daily volume by the length of a day gives a useful baseline, not a peak forecast. A launch, a scheduled import, a cold cache or retrying clients can create a different workload. Choose named scenarios and later replace their assumptions with appropriate measurements.

Keep dimensions visible. Requests per day, bytes per request and retained bytes are different quantities. Multiplying request volume by response size estimates transferred payload, not necessarily newly stored data. Repeatedly reading the same item does not create another copy of that item in the cache.

Model the work at each boundary. A read may be served from cache or become a database operation. A write may update durable data and invalidate a derived copy. Response traffic travels back to the caller. Replication and background maintenance introduce other work that must be accounted for separately.

The diagram deliberately names logical demand rather than a number of servers. Selecting instances requires evidence about usable capacity under the request mix, latency objective and failure conditions. A cache-hit assumption cannot stand in for that evidence.

Maya's campaign provides a concrete arrival scenario. In this hypothetical calculation, 120,000 recipients multiplied by a 15% click assumption gives 18,000 visits. If 60% of those visits arrive in the first minute, the first-minute volume is 18,000 × 0.60 = 10,800 visits, and 10,800 / 60 = 180 visits per second. Neither percentage is an observed campaign result. They are explicit assumptions that a later measurement can replace independently.

A visit is still not a request to every component. Suppose, solely for this example, the landing page makes three catalogue requests per visit. Catalogue demand is 180 × 3 = 540 requests per second. With an assumed warm hit fraction of 80%, misses contribute 540 × 0.20 = 108 reads per second to Postgres. A completely cold Redis cache contributes 540 instead. The required backend envelope therefore includes both states, rather than treating 108 as a guaranteed ceiling.

Separate the resource budgets before choosing a deployment. Payload bandwidth depends on response size; database pressure also depends on predicates, rows examined and writes; cache memory depends on retained objects and representation overhead. There is no valid conversion from 540 requests per second to a specific machine count without a service-capacity measurement under the same workload. A capacity plan should identify which measurement would resolve that missing conversion.

The useful output is a decision with a range of consequences. If the first-minute share doubles while total visits stay fixed, the burst rate doubles but daily retained data does not. If response size doubles, payload bandwidth doubles without establishing any change in the number of database operations. Following those dimensions separately prevents one optimistic average from silently deciding the whole architecture.

Hypothetical scenario. Choose 100 million active users and ten reads per user per day. Daily reads are 100,000,000 × 10 = 1,000,000,000. A day contains 24 × 60 × 60 = 86,400 seconds, so average read demand is 1,000,000,000 ÷ 86,400 ≈ 11,574 reads/s. Separately choose ten million writes per day: 10,000,000 ÷ 86,400 ≈ 115.7 writes/s.

For a peak planning scenario, choose 25,000 reads/s and 250 writes/s. These values are assumptions, not measured peaks or universal multiples of the average. With a chosen 2,000-byte response, read response payload is 25,000 × 2,000 = 50,000,000 bytes/s = 50 decimal MB/s. Multiplying by eight bits per byte gives 400 Mbit/s. Requests, protocol overhead, replication and compression are outside this payload-only budget.

Assume each write adds a new retained 500-byte record. Raw growth is 10,000,000 × 500 = 5,000,000,000 bytes/day = 5 decimal GB/day. Choose 365-day years and no deletion. Annual growth is 5 × 365 = 1,825 GB = 1.825 TB. Five years give 9.125 TB. Three full copies give 9.125 × 3 = 27.375 TB. A separately chosen twenty-percent index allowance on each copy gives 27.375 × 1.2 = 32.85 TB. This excludes logs, backups, temporary rewrite space and other implementation overhead.

The assumption that every write adds a retained record matters. Updating an existing value, retaining old versions and appending an event have different storage consequences. State the chosen retention model rather than automatically treating every write as permanent growth.

For cache allocation, choose fifty million distinct items with 2,000 bytes of cached payload each: 50,000,000 × 2,000 = 100 GB. Selecting ten million items requires 20 GB of payload. A hypothetical twenty-five-percent overhead allowance gives 20 × 1.25 = 25 GB. That allowance is not a measured property of a particular cache implementation.

If the chosen hit rate is eighty percent, peak hits are 25,000 × 0.8 = 20,000 reads/s and misses are 25,000 − 20,000 = 5,000 reads/s. Assuming one database operation per miss and one per write, backend demand is 5,000 + 250 = 5,250 operations/s. With no cache hits, it is 25,000 + 250 = 25,250 operations/s. Neither count establishes how many database instances are needed.

The primary reference establishes this concrete distinction: request costs can differ; request rate alone may not represent resource demand.

Change one assumption and trace what moves. Doubling response payload doubles the response-bandwidth estimate but need not double request-processing work. Extending retention changes stored data without necessarily changing current arrival rates. A more expensive query can reduce usable request capacity without changing payload size.

Layer 3 · Internals

Trade-offs and limits

ApproachProvidesRequires
Action-based estimateKeeps units and assumptions visible.Must be replaced by representative measurement before provisioning.
Production workload measurementIncludes real request mix and service behavior.A sample may omit future skew or a changed user action.

Recovery decision

Hypothetical scenario: A popular document concentrates reads on one key. Aggregate CPU can remain low while its shard saturates; test the busiest key and the selected cache-miss path.

Only if the miss behavior and cold-start policy justify that assumption. A restart, skew shift or synchronized expiry can send far more traffic to storage. Bound cold misses and test recovery rather than treating the normal hit ratio as an availability guarantee.

Write your design before revealing the review

A 90% cache hit rate is measured during normal traffic. Can the database be sized for only 10% of peak?

Evidence you can explain in your own design

Drafts and self-review are stored only in this browser. They are separate from reading completion.

Compare your decision

Only if the miss behavior and cold-start policy justify that assumption. A restart, skew shift or synchronized expiry can send far more traffic to storage. Bound cold misses and test recovery rather than treating the normal hit ratio as an availability guarantee.

A popular document concentrates reads on one key. Aggregate CPU can remain low while its shard saturates; test the busiest key and the selected cache-miss path.

Check your understanding

A 90% cache hit rate is measured during normal traffic. Can the database be sized for only 10% of peak?

Only if the miss behavior and cold-start policy justify that assumption. A restart, skew shift or synchronized expiry can send far more traffic to storage. Bound cold misses and test recovery rather than treating the normal hit ratio as an availability guarantee.

How would you recover from this failure: A popular document concentrates reads on one key. Aggregate CPU can remain low while its shard saturates; test the busiest key and the selected cache-miss path.

Start with the exact boundary that failed. Choose active users and operations per user before selecting a peak multiplier. Count logical reads separately from retry attempts. Identify the resource that the busiest operation consumes. Then recover evidence through the observation path: Trace the dominant query to its index and payload. Determine whether cache hits avoid database work. Check that the remaining database traffic fits the survivor budget. Preserve the distinction between a confirmed state change and an unavailable response.

Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?

Choose 100,000 daily users making 20 reads each: 100,000 × 20 = 2,000,000 reads/day. Average is 2,000,000 / 86,400 = 23.15 reads/s approximately; a chosen 5× peak is 115.74 reads/s. At a hypothetical tested budget of 80 reads/s per server, three servers leave two survivors with 160 reads/s. This says nothing about database capacity until that resource is separately bounded. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Estimate a hypothetical document service. Count reads, mutations and retained objects separately; do not size storage from every HTTP request. A successful estimate ends in a capacity decision rather than a large byte total.

Which component in this topology could be removed from a smaller first deployment?

Readers, API pool, Document database, Object storage name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Choose active users and operations per user before selecting a peak multiplier.

What evidence must a caller have before relying on the observation path?

Trace the dominant query to its index and payload. Determine whether cache hits avoid database work. Check that the remaining database traffic fits the survivor budget. Only if the miss behavior and cold-start policy justify that assumption. A restart, skew shift or synchronized expiry can send far more traffic to storage. Bound cold misses and test recovery rather than treating the normal hit ratio as an availability guarantee.

45-minute interview rubric

  1. 00–05: scope user action and workload model.
  2. 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
  3. 12–28: draw workload model, numbered writes and reads.
  4. 28–40: challenge recovery: Measure a representative action before buying capacity.
  5. 40–45: defend daily_users placement, observations and remaining assumptions.

Go deeper

Decision log

Measure a representative action before buying capacity.

Preserve user action identity and workload model ownership.

Revisit changed workload, observations or recovery objectives.