Learning pathsPricingChecking sign-in…
Core Concepts

Numbers to Know

Estimation is a way to expose constraints, not a memory contest about hardware constants.

What, why, when and how

What is it?

Capacity estimation translates product assumptions into request rates, concurrency, storage, bandwidth and recovery time.

Why is it needed?

Numbers reveal whether a proposed design meets a deadline or merely moves an overload into a queue.

When should I use it?

Use arithmetic when it can change a choice such as worker count, retention, partitioning or admission limits.

When should I choose something else?

Avoid precise-looking forecasts without workload assumptions, and skip calculations that cannot influence a design decision.

How do I use it?

Write units explicitly, distinguish averages from peaks, estimate one limiting resource, and include overhead, retries and headroom before validating with measurements.

Can you show a concrete example?

One million jobs at 500 completions per second require at least 2,000 seconds with no new arrivals. If another 400 jobs per second arrive, spare drain capacity is only 100 per second and that initial backlog takes 10,000 seconds.

Backlog 1,000,000; completion rate 500/s; With no arrivals: 1,000,000 / 500 = 2,000 s; With 400/s arriving: drain at 100/s = 10,000 s
Numbers to Know: one concrete example
Read the diagram

Backlog 1,000,000; completion rate 500/s; With no arrivals: 1,000,000 / 500 = 2,000 s; With 400/s arriving: drain at 100/s = 10,000 s

Open original
Numbers to Know: worked example
Backlog 1,000,000; completion rate 500/s; With no arrivals: 1,000,000 / 500 = 2,000 s; With 400/s arriving: drain at 100/s = 10,000 s

Numbers to Know: one concrete example

Follow the detailed diagrams below to trace the additional state changes and failure cases behind these answers.

Estimation is a way to expose constraints, not a memory contest about hardware constants. Write the units beside every number and distinguish average traffic, peak traffic, and sustained overload. Use a small number of explicit assumptions to decide whether one database, a worker pool, or a provider budget is the limiting resource.

Learning goals

Units; average and peak QPS; concurrency from rate and latency; storage and retention; replication overhead; queue drain time; uncertainty.

Keep the units visible

Assume eight million events/day, 400 bytes/event, a peak factor of six and three stored copies. These are exercise inputs, not a company's traffic or a hardware benchmark.

Contract / pseudocode
average rate = 8,000,000 / 86,400 = about 92.6 events/s
peak rate = 92.6 * 6 = about 556 events/s
raw daily bytes = 8,000,000 * 400 = 3.2 GB (decimal)
three copies = 9.6 GB/day, before indexes and metadata
30 days = 288 GB, before compression and operational headroom
peak payload bandwidth = 556 * 400 * 8 = about 1.78 Mbit/s
average rate = 8,000,000 / 86,400 = about 92.6 events/s; peak rate = 92.6 * 6 = about 556 events/s; raw daily bytes = 8,000,000 * 400 = 3.2 GB (decimal); three copies = 9.6 GB/day, before indexes and metadata; 30 days = 288 GB, before compression and operational headroom; peak payload bandwidth = 556 * 400 * 8 = about 1.78 Mbit/s
Keep the units visible
Read the diagram

average rate = 8,000,000 / 86,400 = about 92.6 events/s; peak rate = 92.6 * 6 = about 556 events/s; raw daily bytes = 8,000,000 * 400 = 3.2 GB (decimal); three copies = 9.6 GB/day, before indexes and metadata; 30 days = 288 GB, before compression and operational headroom; peak payload bandwidth = 556 * 400 * 8 = about 1.78 Mbit/s

Open original
Keep the units visible
average rate = 8,000,000 / 86,400 = about 92.6 events/s; peak rate = 92.6 * 6 = about 556 events/s; raw daily bytes = 8,000,000 * 400 = 3.2 GB (decimal); three copies = 9.6 GB/day, before indexes and metadata; 30 days = 288 GB, before compression and operational headroom; peak payload bandwidth = 556 * 400 * 8 = about 1.78 Mbit/s

Keep the units visible

At a stable average 556 operations/s and 0.2 s average in-service time, Little's Law suggests about 111 concurrent in-service operations under the stated steady-state assumptions. This is not a p99 queue-delay guarantee or a safe connection-pool setting: variability, burst duration, downstream quotas and reserved capacity matter. A measured sink at 400/s cannot sustain that peak indefinitely; calculate the burst backlog and permitted delay.

Bytes versus bits introduces an eightfold factor. Decimal GB versus binary GiB creates another difference; state the convention. Replication, indexes, retained logs, retries and backups increase cost beyond the payload. Compression can reduce bytes but consumes CPU and depends on data. Avoid assuming one universal server throughput: benchmark representative payloads, query shapes, hot keys and durability settings.

Show answer and explanation

Answer: The raw dataset is small enough that sharding is not justified by the average rate alone. Compare a measured single-owner budget and recovery objective first. Spend interview arithmetic on a decision it can change, such as sink capacity or retained storage.

Step-by-step reasoning

1. Convert daily volume into rates

Divide requests per day by 86,400 to obtain average requests per second. Then state a plausible peak factor rather than treating the average as capacity. A regional launch or campaign can have a very different traffic shape from ordinary browsing. Separate user requests from downstream operations; one page may trigger several database reads.

2. Estimate concurrency from latency

In a stable system, average in-flight work is approximately arrival rate multiplied by average time in system. At 500 requests/s and 0.2 seconds, expect about 100 in-flight operations. This is not a universal thread count or a tail-latency guarantee. Queue waiting is part of total latency, and unstable overload invalidates a steady-state assumption.

3. Account for storage and bandwidth

Multiply records per day by bytes per record and retention days. Add indexes, replication, metadata, and working headroom separately rather than hiding them in an unexplained multiplier. Distinguish decimal GB from binary GiB when precision matters. For blobs, transfer bandwidth may dominate metadata QPS.

4. Calculate backlog and drain time

If arrivals exceed service rate, backlog grows at the difference. Once arrivals stop, drain time is backlog divided by service rate; if arrivals continue below capacity, divide by spare capacity instead. Adding workers cannot overcome a fixed provider limit. Name the admission policy when the queue age would exceed the product deadline.

Contracts and state

The following sketch makes the decision boundary concrete. Field names and capacity assumptions are illustrative; adapt them to the stated product contract.

Contract / pseudocode
Campaign: 1,000,000 messages
Provider limit: 500 messages/s
Best-case dispatch floor: 1,000,000 / 500 = 2,000 s
2,000 s = 33 min 20 s (before retries and overhead)

Arrivals 12,000/s; service 8,000/s
One-hour backlog growth = 4,000 * 3,600 = 14,400,000

Worked example

A million-recipient campaign must finish in ten minutes. Even with unlimited workers, a 500/s provider budget can submit only 300,000 messages in that window. The design needs a changed deadline, a higher contracted budget, or a carefully coordinated alternative provider. A larger queue merely holds the unmet promise. This is the moment where arithmetic should change the architecture or requirement.

Keep arrival rate, service rate, and queue growth in distinct units.
Keep arrival rate, service rate, and queue growth in distinct units.
Read the diagram

Arrivals are 12000 events per second and service is 8000. Backlog grows linearly by 4 million per 1000 seconds, reaching 14.4 million after an hour.

Open original
Capacity · backlog grows when arrival exceeds service
Keep arrival rate, service rate, and queue growth in distinct units.

Keep arrival rate, service rate, and queue growth in distinct units.

Failure walkthrough

Averages can conceal saturation. A worker pool averaging 50% utilization may still fail if most traffic arrives in a short burst or all expensive jobs target one partition. Track queue age, per-partition load, p95/p99 latency, and error rate. Present a sensitivity range: if message size doubles, which storage or bandwidth number changes, and which capacity limit does not?

State volume and units → Estimate average and peak → Find limiting service rate → Compute queue growth → Revise deadline or capacity
Numbers to Know · scenario walkthrough
Read the diagram

State volume and units → Estimate average and peak → Find limiting service rate → Compute queue growth → Revise deadline or capacity

Open original
Numbers to Know · scenario walkthrough
State volume and units → Estimate average and peak → Find limiting service rate → Compute queue growth → Revise deadline or capacity

Numbers to Know · scenario walkthrough

Decisions and trade-offs

QuantityFormulaCommon mistake
Average QPSdaily requests / 86,400Calling it peak capacity
Concurrencyrate × average latencyMixing ms with seconds
Drain with arrivalsbacklog / (service - arrivals)Ignoring ongoing work

Check your understanding

A queue contains 60,000 jobs, workers finish 500/s, and new work arrives at 300/s. How long to drain?

Show answer and explanation

Answer: 300 seconds: spare capacity is 200 jobs/s, so 60,000/200 = 300. Dividing by 500 would incorrectly assume no new work arrives. If arrivals reach or exceed 500/s, the backlog does not drain under these assumptions.

Transfer to a new scenario

Estimate a one-million-message campaign against a 500-message/s provider budget and expose the completion-time lower bound.

Why can adding workers leave campaign completion time unchanged?

Continue the connection

Study Scaling Writes and explain which guarantee from this lesson carries into that topic.

Turn arithmetic into an architectural decision

Always carry units. Ten million events/day divided by 86,400 seconds/day is about 116 events/s. A 10× peak is about 1,157/s. At 1 KB/event, raw volume is 10 GB/day using decimal units. Three replicas make 30 GB/day before indexes, logs and retention; compression changes the payload term but not every overhead equally.

Little’s Law relates average concurrent work L to throughput λ and average time W in a stable system: L = λW. At 2,000 requests/s and 200 ms average service time, expect about 400 in-flight requests. This is not a p99 sizing formula and breaks as a simple steady-state planning shortcut when backlog grows without bound.

Queues require a second calculation. If arrival is 12,000/s and service 8,000/s, backlog grows by 4,000/s. After an hour it is 14.4 million. If service later rises to 16,000/s while arrival remains 12,000/s, ideal drain time is another hour. Autoscaling must respect downstream quotas, not just queue length.

A decision worksheet for Numbers to Know: read the mechanism and its guarantee together.
A decision worksheet for Numbers to Know: read the mechanism and its guarantee together.
Read the diagram

Quantity / Formula / Common mistake; Average QPS / daily requests / 86,400 / Calling it peak capacity; Concurrency / rate × average latency / Mixing ms with seconds; Drain with arrivals / backlog / (service - arrivals) / Ignoring ongoing work

Open original
Numbers to Know choices for this workload
A decision worksheet for Numbers to Know: read the mechanism and its guarantee together.

A decision worksheet for Numbers to Know: read the mechanism and its guarantee together.

Operational sketch

Contract / pseudocode
average_qps = daily_requests / 86400
peak_qps = average_qps * stated_peak_factor
raw_bytes = events * bytes_per_event
inflight ≈ throughput_per_second * mean_seconds
drain_seconds = backlog / (service_rate - arrival_rate)

A tempting mistake

Do not multiply every pessimistic factor without explaining the scenario, and do not confuse bits/s with bytes/s. A fleet average can hide one hot tenant or one overloaded shard.

Transfer exercise

A provider allows 500 requests/s. Workers take 0.2 seconds per call. Is 10,000 concurrency useful?

Show answer and explanation

Answer: About 100 in-flight calls supports the ideal quota rate at that mean latency. Extra headroom may absorb variation, but 10,000 concurrent calls cannot lawfully raise the quota and can magnify retries.

Your study notes