Numbers every engineer should know

In an interview you cannot look anything up. You need a small set of numbers in your head: how long things take, how big common things are, how much one machine can handle, and when systems hit their limits. With these numbers you can tell in seconds if a design is realistic.

All figures here are rounded and approximate. Real values depend on hardware, software and the workload, so in real projects you measure. In an interview, round the number, say the unit, and say what it means for the design.

1. How Long Things Take

Operation Rough time
Read from CPU cache (L1) 1 ns
Read from main memory 100 ns
Random read from a local NVMe SSD 20 to 100 µs
Round trip inside one data center 0.5 ms
Read from a network disk (such as AWS EBS) 0.5 to 1 ms
Redis GET from another machine 0.5 to 1 ms (mostly network time)
Round trip between availability zones in one region 1 to 2 ms
Seek on a spinning disk 10 ms
Round trip across a continent (US east to west) 60 to 70 ms
Round trip across an ocean 70 to 100 ms
Round trip between the US and India about 200 ms

Four things to remember from this table:

  • A network call costs about 5,000 memory reads. 0.5 ms divided by 100 ns is 5,000. A design that makes many small calls is slow, even if each call is fast.
  • Distance sets a minimum. Light in fibre travels about 200 km per millisecond. A round trip costs at least 1 ms per 100 km of distance. No engineering can beat that.
  • Do not put a cross-region call on the main request path. Copy the data close to the users instead.
  • Averages hide slow requests. The p99 is the time that 99 out of 100 requests beat. Always ask for the p99 target, not the average.

1.1 Using Latency: A Budget

Say a feed request must finish in 200 ms at p99.

  • Good design: load balancer (1 ms) + app logic (5 ms) + cache lookup (1 ms) + one database read on a miss (5 ms) = 12 ms.
  • N+1 queries: one database read per photo, 20 in a row, is 20 × 5 ms = 100 ms. The fix is one batched query.
  • N+1 with the database in another region: 20 × 70 ms = 1,400 ms, seven times over budget. The fix is never to cross regions on the main path.

1.2 Tail Latency Adds Up

Suppose each backend call is slow (above its p99) 1% of the time. A request that calls one backend is slow 1% of the time. A request that fans out to 100 backends and waits for all of them is slow 1 − 0.99100 = 63% of the time. The more services a request touches, the more often it meets the slow one. Reduce fan-out, set timeouts, and send a backup request if a call is slow.

2. Units and Sizes

2.1 Time and Size Conversions

  • Seconds in a day: 86,400, which is about 100,000. So requests per day divided by 100,000 is about requests per second. One million requests a day is about 12 per second, 100 million is about 1,200, and one billion is about 12,000.
  • Seconds in a 30-day month: 2.6 million. In a year: 31.5 million.
  • Sizes: 1 KB = 1,000 bytes, 1 MB = 106, 1 GB = 109, 1 TB = 1012, 1 PB = 1015.
  • Powers of two: 210 is about a thousand, 220 a million, 230 a billion, 240 a trillion.
  • Bits and bytes: network speed is in bits per second, storage is in bytes. Divide by 8. 1 Gbps is 125 MB/s, and 10 Gbps is 1.25 GB/s. Mixing these up is the most common arithmetic mistake.

2.2 How Big Is It?

Item Typical size
Integer ID, timestamp, IPv4 address 8 B, 8 B, 4 B
UUID 16 B as binary, 36 B as text
Average URL 100 B
Short text post with metadata 300 B
Database row or log line 0.2 to 1 KB
JSON API response 1 to 10 KB
Thumbnail image 20 to 200 KB
Phone photo (JPEG) 2 to 5 MB
1 minute of music (128 kbps) 1 MB
1 minute of 1080p video (5 Mbps) 37.5 MB (2.25 GB per hour)
1 minute of 4K video (25 Mbps) 188 MB

2.3 How Long Does a Transfer Take?

Divide the size by the speed. Add the round trip on top.

  • 1 MB over 1 Gbps: 8 Mb ÷ 1,000 Mbps = 8 ms.
  • 1 GB over 10 Gbps: 0.8 seconds.
  • 1 TB at 1 GB/s: 1,000 seconds, about 17 minutes.
  • 1 PB over 10 Gbps: 1015 B ÷ 1.25 GB/s is about 9 days. Moving petabytes over a network takes days, so large migrations need a plan.

Disk speeds, for comparison: a spinning disk reads 100 to 200 MB/s and does 100 to 200 random operations per second (IOPS). A SATA SSD reads about 500 MB/s. An NVMe SSD reads 1 to 3 GB/s and does over 100,000 IOPS. An AWS EBS gp3 volume gives 125 MB/s and 3,000 IOPS by default, and can be raised to 1,000 MB/s and 16,000 IOPS.

3. How Much One Machine Can Handle

Capacity depends on the machine, so always name the one you assume. These figures assume AWS EC2 instances and simple requests, with Java on Apache Tomcat for the application server. Treat them as orders of magnitude.

Component Reference machine Rough capacity What changes it
Stateless app server (Tomcat) m5.xlarge: 4 vCPU, 16 GB RAM 1,000 to 5,000 simple requests/s. This course plans with about 2,000. Work per request. A request that calls other services can cost 10 times more than a simple lookup
Cache (Redis) r5.xlarge: 4 vCPU, 32 GB RAM 50,000 to 200,000 operations/s. This course plans with about 100,000, and about 24 GB of the 32 GB is usable for data. RAM sets how much data fits. Large values lower the rate
Relational database primary r5.4xlarge: 16 vCPU, 128 GB RAM, SSD 5,000 to 20,000 writes/s, tens of thousands of simple reads/s Disk speed, number of indexes, and whether hot data fits in RAM
Kafka partition m5.2xlarge: 8 vCPU, 32 GB RAM, fast disk 10,000 to 50,000 messages/s Message size, disk speed, replication settings

3.1 Limits That Surprise People

Capacity often runs out at a default limit before CPU or RAM. Defaults change between versions, so check the documentation. These are worth knowing:

  • Tomcat: 200 request threads by default (maxThreads). Threads needed = requests per second × time per request (Little's law, section 3.4). At 2,000 requests/s and 5 ms each, you need 10 threads. If every request waits 200 ms for a slow dependency, you need 400, and the pool runs out.
  • Database connections: PostgreSQL allows 100 by default, MySQL 151. Ten app servers with a pool of 20 each need 200, which is too many for PostgreSQL. Plan pool sizes and database limits together.
  • HikariCP connection pool: 10 connections by default. A small pool is often enough, and a very large one can hurt the database.
  • Kafka: about 1 MB maximum message size. Put large files in object storage and send a reference.
  • DynamoDB: 400 KB per item, and about 3,000 reads and 1,000 writes per second per partition. One hot key can be throttled long before the table's total limit.
  • S3: about 3,500 writes and 5,500 reads per second per key prefix. Spread keys across prefixes for very high rates.

3.2 What Fits on One Machine

Scale up before you scale out. One modern machine is bigger than most people expect:

  • Memory: memory-optimized EC2 instances go up to several hundred GB (an r5.24xlarge has 768 GB). A 50 GB working set needs no sharding.
  • Disk: a database node can hold several TB. In practice, keep one node under a few TB, because backup, restore and replica setup take hours beyond that.
  • Network: an m5.xlarge gets up to 10 Gbps, which is about 1.25 GB/s. A cache serving 100 KB values hits the network limit (about 12,000 per second) long before its CPU limit.
  • Rule: shard when one machine fails any of four limits: writes per second, data size, memory for the hot set, or network. Name the limit that forced the split.

3.3 Example: Do We Need to Shard?

A ride-hailing app has 600,000 drivers online on average and 1 million at peak. Each sends its location every 4 seconds. Each record is about 100 bytes.

  • Write rate: 600,000 × 86,400 ÷ 4 is about 13 billion updates a day. That is 150,000 per second on average and 1,000,000 ÷ 4 = 250,000 per second at peak.
  • A relational primary handles 5,000 to 20,000 writes per second, so you would need 13 to 50 primaries. That is the wrong tool.
  • Data size: only the latest position matters, so 1,000,000 × 100 B = 100 MB. This fits in memory many times over.
  • Decision: keep the latest positions in Redis. 250,000 operations per second is a few Redis nodes (one does about 100,000), mostly for throughput. Write only trip events to the database, which is a tiny load.

A very high rate on very little data points to memory, not to sharding a database.

3.4 Planning Rules

Three rules turn the machine numbers into a design.

  • Little's law: the number of requests in flight equals the arrival rate × the time each one takes. 2,000 requests/s at 100 ms means 200 in flight. Use it to size thread pools, connection pools and queues.
  • Plan at about 70% utilization. A machine that can do 500 requests/s at its limit should be planned at 350. Waiting time grows by about 1 ÷ (1 − utilization): 2 times at 50%, 5 times at 80% and 10 times at 90%. Near full load, small bursts become long delays.
  • Keep headroom for failure. With three zones, losing one leaves two to carry all the traffic, so size the total at 1.5 times the peak need. With four zones the factor is 1.33.

4. Availability and Failure

Availability Downtime per year Per 30-day month
99% 3.65 days 7.2 hours
99.9% 8.76 hours 43.2 minutes
99.99% 52.6 minutes 4.3 minutes
99.999% 5.3 minutes 26 seconds

Each extra nine costs more redundancy and automation. Ask what the business needs. Do not promise five nines.

To combine availabilities, assume the parts fail independently. Real failures are often not independent, so treat the result as a best case.

  • In a chain (all must work): multiply. Three services at 99.9% each give 0.999 × 0.999 × 0.999 = 99.7%, which is about 26 hours of downtime a year. Every extra dependency in a request path lowers availability.
  • In parallel (one is enough): failure chances multiply. Two copies at 99% each give 1 − (0.01 × 0.01) = 99.99%. This is why redundancy works.

At scale, hardware fails all the time. A disk fails about 1 to 2% of the time each year. Among 1,000 disks at 1.5%, expect about 15 failures a year, more than one a month. Treat failure as routine: keep 3 copies of data and recover automatically.

5. Cost Numbers

These are rough US East list prices. They change, so check current pricing. They show how things compare.

  • Object storage (S3 standard): about $0.023 per GB-month. 1 PB costs about $23,000 a month.
  • Data out to the internet: about $0.09 per GB. Moving data out often costs more than storing it. A CDN is usually cheaper per GB.
  • Data between availability zones: about $0.01 per GB in each direction. Chatty cross-zone traffic adds up.
  • m5.xlarge on demand: about $0.19 per hour, or $140 a month. Ten app servers cost about $1,400 a month.

6. Common Pitfalls

  • Thinking a million requests a day is a lot. It is 12 per second. One server handles it.
  • Sizing for the average. Servers fail at peak. Multiply by 2 to 10 (use 4 if you are not told).
  • Mixing bits and bytes. Divide network speeds by 8.
  • Forgetting copies in storage. Raw data times the number of replicas, plus indexes and backups.
  • Treating network calls as free. Each costs about 5,000 memory reads, and a cross-region call costs 60 to 150 ms.
  • Sharding too early. Check whether one bigger machine or an in-memory store solves it first.
  • Quoting capacity without a machine. Say which instance type you assume.
  • Computing a number and never using it. End each one with a decision: cache, CDN, shard or queue.

7. Interview Questions This Lesson Prepares You For

  • How many requests per second is 10 million requests a day? About 100 per second on average (10M ÷ 86,400 is 116). At a 4x peak, about 460.
  • Why not read from a database in another region on every request? Each call costs 60 to 150 ms. A page that makes several calls misses a 200 ms target. Replicate data near the users instead.
  • What is the availability of three services at 99.9% each, called in sequence? About 99.7%, or 26 hours of downtime a year. Each dependency lowers the total.
  • A request calls 100 services in parallel, and each is slow 1% of the time. How often is the request slow? 1 − 0.99100 = 63%. Reduce fan-out, set timeouts, and use backup requests.
  • You have 10 app servers with a pool of 20 connections each, and a database that allows 100. What happens? The servers ask for 200 connections. Some requests fail or wait. Reduce the pool size, add a connection proxy, or raise the database limit if it can cope.
  • How long does it take to copy 100 TB over a 10 Gbps link? 100 TB ÷ 1.25 GB/s is 80,000 seconds, about 22 hours, if the link is fully used. In practice it takes longer.