System Design Fundamentals
Vote

0% completed

Numbers You Should Know

How big data is

How long operations take

How many seconds there are

Estimation is multiplication and division. What makes it fast is having a small set of facts already in your head, so that no step in the calculation requires looking anything up.

There are three groups of them: how big data is, how long operations take, and how many seconds are in a day.

How big data is

Each step up the ladder multiplies by about a thousand.

UnitRoughlySomething that size
ByteOne character of textThe letter A
Kilobyte (KB)A thousand bytesA page of plain text
Megabyte (MB)A million bytesA high quality photo
Gigabyte (GB)A billion bytesA feature length movie
Terabyte (TB)A thousand GBA laptop hard drive
Petabyte (PB)A thousand TBThe photo library of a large service
Each rung of the ladder is about a thousand times the one below it, from a page of text to the storage of a whole product
Each rung of the ladder is about a thousand times the one below it, from a page of text to the storage of a whole product

A kilobyte is strictly 1,024 bytes, not 1,000. In an estimate, treat it as 1,000. The 2 percent error it introduces disappears next to an assumption like "about 10 percent of users post each day", and it makes every multiplication something you can do in your head.

The sizes worth memorizing are the ones you will multiply by a user count.

ObjectAssume
A short text post, with its metadataHundreds of bytes
A thumbnail imageTens of KB
A compressed photoHundreds of KB
A minute of streaming videoTens of MB

How long operations take

Absolute latencies drift as hardware improves. The ratios between them do not, and the ratios are what change a design.

OperationRoughlyCompared with memory
Read from memory100 nanoseconds1x
Read from an SSD100 microsecondsAbout 1,000x slower
Round trip inside one data center500 microsecondsAbout 5,000x slower
Seek on a spinning disk10 millisecondsAbout 100,000x slower
Round trip across the world150 millisecondsAbout 1,500,000x slower
Five operations in order, with how much slower each one is than the step above it
Five operations in order, with how much slower each one is than the step above it

Three consequences follow from that table, and they show up in almost every design.

Memory is worth a lot. Serving a request from memory rather than from disk is not a small improvement, it is a change of category. That is the entire argument for caching, in one line.

Distance costs more than hardware. A round trip across the world is slower than a disk seek. No faster machine on the other side of the planet fixes that, which is why content is served from locations near the user rather than from one central place.

Round trips add up. A request that makes 10 sequential calls inside the data center has spent 5 milliseconds before doing any work. This is why designs try to make calls in parallel, or fetch in one call what would otherwise take several.

How many seconds there are

This is the fact that converts a business number into an engineering number.

A day has 86,400 seconds. Round it to 100,000. The result is 15 percent low, which is fine, and it makes the division trivial: drop five zeros.

Per dayPer second
100,0001
1 million10
100 million1,000
1 billion10,000
Dividing a daily count by 100,000 seconds turns a business number into a requests-per-second number by dropping five zeros
Dividing a daily count by 100,000 seconds turns a business number into a requests-per-second number by dropping five zeros

Traffic is never spread evenly across the day, so the average is not the number to build for. Peak traffic is commonly two to three times the average, and a service with a sharp daily cycle can be higher still. State the multiplier you are using and apply it once, at the end.

💡 If you remember nothing else, remember that a day is about 100,000 seconds and that memory is about a thousand times faster than an SSD. Those two facts carry most estimation questions on their own.

Key takeaway: Each unit of data size is about a thousand times the one below it, and a kilobyte can be treated as 1,000 bytes in an estimate. Memory is around a thousand times faster than an SSD, a local network round trip is thousands of times slower than memory, and a round trip across the world is slower than a disk seek, which is why caching and serving content near the user matter so much. A day is about 100,000 seconds, so a daily count becomes a per-second count by dropping five zeros, and peak traffic is usually two to three times the average.

The next lesson, Estimating QPS, Storage, and Bandwidth, puts these facts into the three calculations you will actually be asked for.

On This Page

How big data is

How long operations take

How many seconds there are