System Design Fundamentals Cheatsheet

Quick reference for estimation math, latency numbers, powers of two, CAP/PACELC, consistency models, and availability nines.

EstimationLatencyCAPNines
NotesCheatsheet

Estimation Numbers

Powers of Two

PowerApproxBytes
2^101 thousand1 KB
2^201 million1 MB
2^301 billion1 GB
2^401 trillion1 TB
2^501 quadrillion1 PB

Time Constants

seconds/day   ~= 86,400   (~10^5)
seconds/month ~= 2.5 million
QPS  = daily_requests / 86,400
peak = average x 2 to 3 (higher for spikes)

Char / Object Sizes

ASCII char  = 1 byte      UTF-8 char = 1-4 bytes
UUID        = 16 bytes     timestamp  = 8 bytes
short tweet ~= 300 bytes   thumbnail  ~= 20 KB
photo       ~= 200 KB-2 MB 1 min 1080p video ~= 50 MB

Latency Numbers

OperationLatency
L1 cache~1 ns
L2 cache~4 ns
RAM reference~100 ns
Read 1 MB from RAM~3 µs
SSD random read~16 µs
Read 1 MB from SSD~50 µs
Datacenter round trip~0.5 ms
HDD seek~5 ms
Cross-continent RTT~150 ms

Rule of thumb: RAM >> SSD >> network >> disk. Batch network calls; cache in memory; never seek disk on the hot path.

CAP & PACELC

CAP: pick 2 of 3 (P is mandatory in practice)
  CP -> consistent, may reject during partition (etcd, HBase)
  AP -> available, may serve stale (Cassandra, DynamoDB)

PACELC: if Partition -> A or C;  Else -> Latency or C
  Cassandra/Dynamo = PA/EL
  MongoDB          = PA/EC
  Spanner/etcd     = PC/EC

Consistency Models

ModelGuarantee
StrongRead always sees latest write
CausalCausally ordered ops preserved
Read-your-writesYou always see your own updates
EventualReplicas converge if writes stop

Availability Nines

UptimeDown / yearDown / month
99%3.65 days7.2 hrs
99.9%8.76 hrs43 min
99.99%52.6 min4.3 min
99.999%5.26 min26 sec
Series (dependency chain): multiply availabilities
  0.999 x 0.999 x 0.999 = 99.7%
Parallel (redundant):     multiply failure rates
  1 - (0.01 x 0.01)      = 99.99%

SLA / SLO / SLI & Framework

TermMeaning
SLIMeasured metric (latency, success rate)
SLOInternal target for an SLI
SLAContractual promise + penalty
Error budget100% - SLO; spend on releases

RESHADED (interview flow)

R  Requirements   (functional + non-functional)
E  Estimation     (QPS, storage, bandwidth)
S  Storage schema (data model, access patterns)
H  High-level     (components + request flow)
A  API design     (endpoints / contracts)
D  Detailed       (sharding, caching, queues)
E  Evaluation     (check vs requirements)
D  Distinctive    (SPOFs, hotspots, bottlenecks)

Section navigation