Cheatsheet

System Design Fundamentals

Latency numbers, units, back-of-envelope formulas, availability nines, SLIs and SLOs, percentiles and scaling on a few printable pages.

01Latency numbers (orders of magnitude)

These figures are approximate and vary by hardware and generation. Learn the ratios between rows, not the exact numbers: memory is about 100x slower than L1 cache, and a cross-continent round trip is about 100,000x slower than reading memory.

Approximate latency of common operations
OperationApproximate timeOrder of magnitude
L1 cache reference~1 nsnanoseconds
L2 cache reference~4 nsnanoseconds
Uncontended mutex lock/unlock~20 nsnanoseconds
Main memory reference~100 nsnanoseconds
Send 1 KB over a 10 Gbps link~1 µsmicroseconds
Read 1 MB sequentially from memory~10–50 µsmicroseconds
Random 4 KB read from NVMe SSD~20–100 µsmicroseconds
Round trip inside one data centre~0.5 mssub-millisecond
Read 1 MB sequentially from SSD~0.2–1 msmilliseconds
Disk seek (spinning HDD)~5–10 msmilliseconds
Round trip between nearby regions~10–30 msmilliseconds
Round trip across a continent or ocean~70–150 mstens to hundreds of ms
  • Avoid network round trips inside a request loop: ten sequential calls at 0.5 ms each cost 5 ms before any work is done.
  • Memory beats SSD, SSD beats network to another region. Caching is about moving data up this table.
  • The speed of light in fibre is about 200 km per ms; physics sets a floor on cross-region latency.

02Units and powers of ten

Size units (decimal, as used for estimates)
UnitBytesPower of tenClose binary unit
KB (kilobyte)1,00010^3KiB = 1,024
MB (megabyte)1,000,00010^6MiB ≈ 1.05 × 10^6
GB (gigabyte)1,000,000,00010^9GiB ≈ 1.07 × 10^9
TB (terabyte)10^1210^12TiB ≈ 1.10 × 10^12
PB (petabyte)10^1510^15PiB ≈ 1.13 × 10^15
Time conversions
PeriodSecondsShortcut
1 minute60
1 hour3,600
1 day86,400≈ 10^5 (round up for quick maths)
1 month (30 days)2,592,000≈ 2.6 × 10^6
1 year (365 days)31,536,000≈ 3 × 10^7 (π × 10^7 is a common memory aid)
Bits vs bytes
Network links are quoted in bits per second; storage in bytes. 1 byte = 8 bits, so 1 Gbps moves about 125 MB per second.
1 million per day
About 12 per second on average (1,000,000 / 86,400 ≈ 11.6).
1 billion per month
About 385 per second on average.

03Back-of-envelope formulas

Core formulas
average RPS      = daily active users × requests per user per day / 86,400
peak RPS         = average RPS × peak factor        (2–5 is typical; measure it)
bandwidth (bps)  = RPS × payload bytes × 8
storage per day  = new records per day × bytes per record
total storage    = per day × 365 × years × (1 + index overhead) × replication factor
servers needed   = ceil(peak RPS / (RPS per server × target utilisation)) + spares
Little's law     L = λ × W   (in-flight requests = arrival rate × time in system)
  • State assumptions out loud and round aggressively: 86,400 ≈ 100,000 is fine for an interview estimate.
  • Separate reads from writes; they usually scale differently (caches absorb reads, writes hit the primary).
  • Size for peak, not average, then add headroom so one failed instance does not overload the rest.
  • Sanity-check the answer against a known system or a single machine’s limits.
Worked example
10M DAU × 20 requests = 200M requests/day
200M / 86,400        ≈ 2,300 RPS average
× peak factor 3      ≈ 7,000 RPS peak
7,000 × 20 KB × 8    ≈ 1.1 Gbps egress at peak
Little's law at 50 ms: 7,000 × 0.05 = 350 requests in flight

04Availability and the nines

Allowed downtime per period (365-day year, 30-day month, 7-day week)
AvailabilityPer yearPer monthPer week
99% (two nines)3.65 days7.2 hours1.68 hours
99.5%43.8 hours3.6 hours50.4 minutes
99.9% (three nines)8.76 hours43.2 minutes10.1 minutes
99.95%4.38 hours21.6 minutes5.04 minutes
99.99% (four nines)52.6 minutes4.32 minutes1.01 minutes
99.999% (five nines)5.26 minutes25.9 seconds6.05 seconds
Composing availability (independent failures assumed)
in series (all must work):  A = A1 × A2 × … × An
in parallel (any one works): A = 1 − (1 − A1) × (1 − A2) × …
example: three 99.9% services in series   → 99.7%
example: two 99.9% replicas in parallel   → 99.9999%
  • Every synchronous dependency lowers your ceiling; you cannot be more available than the chain you call.
  • Redundancy only helps when failures are independent: two replicas on the same rack, power feed or bad deploy fail together.
  • Availability = MTBF / (MTBF + MTTR). Shrinking time to recover is often cheaper than preventing every failure.

05SLI, SLO and SLA

Service level terms
TermWhat it isExampleOwned by
SLI (indicator)A measured ratio of good events to total eventsRequests answered in < 300 ms with a non-5xx status / all requestsEngineering
SLO (objective)A target for an SLI over a window99.9% of requests good over 30 daysEngineering and product
SLA (agreement)A contract with consequences if missedBelow 99.5% monthly → 10% service creditBusiness and legal
Error budget1 − SLO: the unreliability you can spend0.1% of 30 days ≈ 43 minutes of bad requestsShared
  • Set the SLA looser than the SLO so you notice and react before owing credits.
  • Measure SLIs where users feel them (load balancer or client), not only inside the service.
  • When the error budget is spent, slow down risky releases and prioritise reliability work.

06Latency, throughput and percentiles

Latency
Time for one request, from send to response. Report it as a distribution, never only as an average.
Throughput
Work completed per unit of time (requests per second, MB per second).
P50 / P95 / P99
The value below which 50%, 95% or 99% of requests fall. P99 = 400 ms means 1 request in 100 is slower than 400 ms.
Tail latency
The slow end of the distribution (P99 and above). It dominates when one page fans out to many backends.
Utilisation
Fraction of time a resource is busy. Queueing delay grows sharply as utilisation approaches 100%.
Fan-out amplifies the tail
P(at least one slow call) = 1 − 0.99^n   for n parallel calls, each with a 1% chance of hitting P99
n = 10  → 9.6% of page loads see a P99-slow backend
n = 100 → 63%
  • Averages hide outliers: a mean of 50 ms can coexist with a P99 of 2 s.
  • Percentiles cannot be averaged across servers; aggregate the raw histograms instead.
  • Higher throughput usually costs latency once queues form; keep utilisation below about 70–80% for latency-sensitive services.

07Vertical vs horizontal scaling

Scaling approaches compared
AspectVertical (scale up)Horizontal (scale out)
HowBigger machine: more CPU, RAM, faster diskMore machines behind a load balancer
Code changesUsually noneServices must be stateless or share state externally
CeilingLargest available instancePractically unbounded for stateless tiers
Failure impactOne machine is a single point of failureLosing one node removes 1/N of capacity
Cost curveGrows faster than linearly at the high endRoughly linear, plus coordination overhead
Good first choice forDatabases, early-stage systemsWeb and API tiers, workers
  • Scale up first when it is cheap; scale out when you need redundancy or pass a single machine’s limits.
  • Move session state to a shared store (or tokens) before adding web servers.
  • Plan N+1 (or N+2) capacity: enough instances that losing one still serves peak traffic.