Numbers worth knowing
An experienced cook does not weigh salt for every plate: they remember that a pinch is about a gram. That is how they cook fast and rarely go wrong. In load estimates, a few reference numbers play the part of the pinch.
You keep them in your head so as not to spend interview minutes on arithmetic. The analogy breaks in one place: a cook feels a pinch with their fingers, while the reference numbers have to be learned.
Powers of two and ten
A computer counts in powers of two, while an estimate is easier in powers of ten. They nearly match: 2¹⁰ = 1,024 ≈ 10³. That gives a ladder of units:
| Power of two | Roughly | Unit |
|---|---|---|
| 2¹⁰ | thousand, 10³ | kilobyte, KB |
| 2²⁰ | million, 10⁶ | megabyte, MB |
| 2³⁰ | billion, 10⁹ | gigabyte, GB |
| 2⁴⁰ | trillion, 10¹² | terabyte, TB |
| 2⁵⁰ | 10¹⁵ | petabyte, PB |
The ladder gives a rule that saves you from an error of a thousand times: a million kilobytes is a gigabyte, and a billion kilobytes is a terabyte.
Time
Three values turn days and years into seconds:
- a day has 86,400 seconds, roughly 10⁵;
- a month has about 2.6 million seconds;
- a year has about 31.5 million seconds, roughly 3 × 10⁷.
That gives a quick conversion: 1 million events a day is about 12 a second, and 1 billion is about 12,000.
The latency ladder
To tell whether a request fits into 200 ms, you need to know what each step costs. The numbers are rounded, but their order is reliable:
- A read from main memory: about 100 ns.
- A random read from an SSD: about 100 µs.
- A request there and back inside a data center: about 0.5 ms.
- A seek on a hard disk: about 10 ms.
- A trip from California to the Netherlands and back: about 150 ms.
Neighboring steps differ several times over, and up to a thousandfold. A read from memory is a thousand times faster than a read from an SSD. And one request to another continent eats almost the whole 200 ms target: light in fibre covers about 200 km a millisecond, and nothing makes it faster.
What one machine handles
Reference numbers for one ordinary cloud server. The exact values depend on the hardware and the code, but the order is this:
- main memory: 64 to 512 GB;
- disks: tens of terabytes;
- network: 10–25 Gbit/s;
- a stateless service: thousands of requests a second, 2,000 in this course;
- a relational database: thousands of writes and tens of thousands of simple reads a second;
- an in-memory cache such as Redis: about 100,000 operations a second.
These numbers answer the main question of an estimate: does the load fit on one machine. 1,200 posts a second fit. 120,000 feed opens do not: they need dozens of machines.
Common mistake
Calculating with exact numbers: 86,400 instead of 10⁵, 1,024 instead of 1,000. The candidate spends five minutes on long multiplication, and the result differs from the rounded one by some fifteen percent. That does not matter for an estimate, while the interview time is gone.
Key points
- 2¹⁰ ≈ 10³: KB, MB, GB, TB, PB are steps of a thousand, and a million kilobytes is a gigabyte.
- A day has about 10⁵ seconds, a year about 3 × 10⁷.
- Memory 100 ns, SSD 100 µs, data center 0.5 ms, another continent 150 ms.
- One machine handles thousands of requests a second and 10–25 Gbit/s of network.