ML System Design

Back-of-Envelope Capacity Estimation

Performing quick back of the envelope math to estimate memory, network bandwidth, and GPU hardware requirements for system design.

🟡 intermediate5 min readsystem-design
Back of Envelope Capacity Estimation calculates rough hardware and infrastructure requirements early in system design. Engineers convert business metrics like Daily Active Users and request frequencies into technical metrics like queries per second, network bandwidth, vector memory footprint, and GPU server cluster sizes. These rough calculations dictate whether a proposed architecture is technically viable and affordable.

What is Capacity Estimation?

In system design interviews and real world engineering, you must quickly prove whether your proposed design can scale to handle real world data volumes.

Back of the Envelope Capacity Estimation uses simple mental math to calculate required Queries Per Second (QPS), Network Bandwidth, RAM Storage, and GPU Compute.

Daily Active Users ──► Queries Per Second (QPS) ──► Network Bandwidth & RAM Memory

Essential Constants to Remember

Worked Example: Vector Search Memory

Suppose you need to store and search 10 Million Product Vector Embeddings. Each vector has 512 dimensions stored in standard Float32 format.

Memory per Vector = 512 dimensions * 4 Bytes per Float32 = 2,048 Bytes ≈ 2 Kilobytes

Total Memory = 10,000,000 vectors * 2 Kilobytes = 20,000,000 Kilobytes = 20 Gigabytes

Conclusion: The entire 10 million vector index easily fits inside the RAM of a single cloud server!

Worked Example: Traffic QPS and Bandwidth

Suppose your application has 100 Million Daily Active Users (DAU). Each user makes 10 search requests per day.

Total Daily Requests = 100,000,000 users * 10 requests = 1 Billion Requests per day

Average QPS = 1,000,000,000 requests / 86,400 seconds ≈ 11,500 QPS

Peak QPS (2x Average) = 11,500 * 2 ≈ 23,000 QPS

If each request response payload returns 10 KB of JSON data:

$$\text{Peak Bandwidth} = 23,000 \text{ QPS} \times 10 \text{ KB} = 230 \text{ Megabytes per second (MB/s)}$$

This tells you that your network load requires load balancing across multiple web gateway servers.

Say this out loud

Back of the envelope capacity estimation uses simple numbers to calculate QPS, bandwidth, and memory requirements. Rounding seconds in a day to 100,000 makes mental math fast. Knowing data sizes like 4 bytes per float32 vector dimension lets you quickly estimate if a vector index fits in RAM or requires distributed memory clusters.

Followups to expect

  1. How does quantization impact memory estimates? Quantizing float32 vectors to int8 reduces memory footprint by 4 times, allowing 80 Gigabytes of vector data to compress down to 20 Gigabytes.
  2. Why is peak QPS more important than average QPS? Systems must be provisioned for peak traffic spikes (often 2 to 5 times average QPS) to prevent server crashes during high traffic hours.

Check yourself

Question 1 of 3

Why is back of the envelope estimation important during early machine learning system design?

More in ML System Design

See all →
A Framework for Any ML Design Round5 minFraming a Business Problem as ML5 minOnline vs Offline Evaluation5 min