Day 3 A-Foundations 2026-09-29 ← All lessons

Back-of-the-envelope estimation: QPS, storage, availability

In a system design interview, you are often asked to estimate capacity or performance. Back-of-the-envelope calculations help you quickly judge which designs will meet requirements.

3500Tweets QPS (estimated)
7000Peak QPS (estimated)
55 PB5-year media storage
99.9%Typical cloud SLA

Key points

Outcomes

01Understand the power of two for data volume units.
02Memorize key latency numbers and their implications.
03Calculate QPS, peak QPS, and storage for a given scenario.
04Interpret availability percentages and downtime.
01

Power of two: data volume units


Data volume in distributed systems is measured using powers of 2. A byte is 8 bits. An ASCII character uses one byte.

UnitValue
1 KB2^10 bytes = 1,024 bytes
1 MB2^20 bytes = 1,048,576 bytes
1 GB2^30 bytes = 1,073,741,824 bytes
1 TB2^40 bytes = 1,099,511,627,776 bytes
1 PB2^50 bytes = 1,125,899,906,842,624 bytes
Common data volume units
02

Latency numbers every programmer should know


L1 cache reference
1 ns
Branch mispredict
3 ns
L2 cache reference
4 ns
Mutex lock/unlock
17 ns
Main memory reference
100 ns
Compress 1KB with Zippy
2,000 ns = 2 µs
Send 2,000 bytes over commodity network
44 ns
Read 1,000,000 bytes sequentially from memory
3,000 ns = 3 µs
SSD random read
16,000 ns = 16 µs
Read 1,000,000 bytes sequentially from SSD
49,000 ns = 49 µs
Round trip in same data center
500,000 ns = 500 µs
Read 1,000,000 bytes sequentially from disk
825,000 ns = 825 µs
Disk seek
2,000,000 ns = 2 ms
Packet round trip CA to Netherlands
150,000,000 ns = 150 ms
📏 Log scale — each step right is ~10×. Bar lengths show order of magnitude, not raw proportion.
Typical latencies of computer operations (from Google's Dr. Dean, 2010, visualized 2020). Log scale because values range from 1 ns to 150 ms.
Interview tipMemory is fast but disk is slow. Avoid disk seeks. Compress data before sending over the internet. Data centers in different regions add significant latency.
03

Availability numbers


High availability means a system is continuously operational for a long period. It is measured as a percentage, with 100% meaning zero downtime. Most services fall between 99% and 100%. Cloud providers set SLAs at 99.9% or above.

Availability %Downtime per dayDowntime per year
99%14.4 minutes3.65 days
99.9%1.44 minutes8.77 hours
99.99%8.64 seconds52.6 minutes
99.999%0.864 seconds5.26 minutes
Availability nines and corresponding downtime
04

Example: Estimate Twitter QPS and storage


  1. Assumptions: 300M monthly active users, 50% use daily, 2 tweets per day per user, 10% of tweets contain media, data stored for 5 years.

  2. Calculate DAU: 300M * 50% = 150M.

  3. Calculate tweets QPS: 150M * 2 tweets / 24 hours / 3600 seconds = ~3500 QPS.

  4. Calculate peak QPS: 2 * QPS = ~7000 QPS.

  5. Calculate media storage per day: 150M * 2 * 10% * 1 MB = 30 TB per day.

  6. Calculate 5-year media storage: 30 TB * 365 * 5 = ~55 PB.

Interview tipTips: Round numbers and approximate. Write down assumptions. Label units. Practice common estimations: QPS, peak QPS, storage, cache, number of servers.
Q&A

Check yourself


Q1What is the estimated peak QPS for Twitter in the example?
  • 3500
  • 7000
  • 15000
✓ 7000 — Peak QPS is 2 times the average QPS, which is ~3500, so ~7000.
Q2Which operation is the slowest according to the latency numbers?
  • Disk seek
  • Packet round trip CA to Netherlands
  • Read 1,000,000 bytes sequentially from disk
✓ Packet round trip CA to Netherlands — Packet round trip CA to Netherlands takes 150 ms, while disk seek is 2 ms and sequential disk read is 825 µs.
Q3What is the 5-year media storage estimate for Twitter in the example?
  • 30 TB
  • 55 PB
  • 150 PB
✓ 55 PB — Media storage per day is 30 TB, so over 5 years: 30 TB * 365 * 5 = ~55 PB.
Sources: Book, Ch. 2, Power of two, Latency numbers, Availability numbers, Example: Twitter QPS and storage (pp. 1-10)