Skip to main content
PRISM
Loading

Why estimation comes first

An interviewer opens with estimation for the same reason a structural engineer starts with loads: every decision after it depends on the order of magnitude. A design that is right for ten thousand requests a second is wrong for ten, and wrong again for ten million. Getting the number roughly right is what makes the next forty minutes coherent.

Roughly right is the whole standard. Nobody is checking your arithmetic — they are checking whether you know which quantities matter, whether you remember that peak is several times average, and whether you can say “about ten million, call it twenty for headroom” without pretending to a precision the assumptions cannot support.

The five numbers that carry an estimate

Almost every capacity question resolves into the same handful of quantities, and the estimator above is only arithmetic on top of them.

  • Daily actives, and actions each. Monthly actives are a vanity number; the ratio of daily to monthly is usually between a third and a half.
  • The read-to-write ratio. Usually the biggest lever in the whole estimate and the one most often left unstated. A social feed is 100:1 or worse; a logging pipeline is the other way round.
  • The peak multiplier. Human traffic is diurnal. A service sized for its daily mean falls over every evening, and two to three times average is the honest figure.
  • Bytes per action. Including the indexes, which for key-value workloads are frequently larger than the data.
  • Replication and retention. Both multiply storage, and both are forgotten in roughly half of all estimates.

A day is 86,400 seconds, which is 100,000

The single most useful approximation in this whole subject. Dividing by 100,000 is something you can do in your head while talking, and it is within 15% — far inside the precision your assumptions justify. Ten million actions a day is a hundred a second. A billion is ten thousand a second. Those two conversions cover most of what you will be asked.

Then run it

The part that separates an estimate from an understanding is what happens next. Take the number you just produced and push it through something that runs: autilisation curve at that server count, abalancer at that request rate, acache in front of that origin. Nearly everyone is wrong about where their own design breaks, and finding out costs a minute.

The reference tables, in the page source

Latency numbers every programmer should know
L1 cache reference1.0 ns
Branch mispredict3.0 ns
L2 cache reference4.0 ns
Mutex lock/unlock17 ns
Main memory reference100 ns
Compress 1KB with Snappy2.0 µs
Send 1KB over 10GbE800 ns
NVMe SSD random read100 µs
Read 1MB sequentially from memory50 µs
Round trip within a datacentre500 µs
Read 1MB sequentially from NVMe300 µs
Spinning disk seek10 ms
Read 1MB sequentially from spinning disk20 ms
Round trip California to Netherlands150 ms
Rough single-node throughput
Redis, single node100,000/s
Memcached, single node200,000/s
PostgreSQL reads, cached30,000/s
PostgreSQL writes, durable3,000/s
Kafka, per partition50,000/s
Nginx, static responses50,000/s
Application server, typical endpoint1,000/s
Cassandra writes, per node15,000/s
Powers of two
2^101 thousand · 1 KB
2^201 million · 1 MB
2^301 billion · 1 GB
2^324 billion · 4 GB
2^401 trillion · 1 TB
2^501 quadrillion · 1 PB