Back-of-the-envelope reference

Calculations

Round aggressively, label every unit, and state assumptions. Use average, peak, retained, replicated, and headroom figures explicitly.

86,400 s/day

Traffic

average QPS = daily actions / 86,400peak QPS = average QPS × burst factor

Split by operation: reads, writes, uploads, redirects, and background jobs.

Storage

bytes = writes/day × bytes/item × retention daysphysical = raw × replicas × (1 + index/metadata overhead)

Add transcoded renditions, versions, thumbnails, and temporary data separately.

Bandwidth

bytes/s = QPS × average payload bytesbits/s = bytes/s × 8

Calculate ingress and egress independently. CDN egress often dominates media cost.

Concurrency

concurrent work ≈ arrival rate × average time in system

At 10,000 requests/s and 0.2 s average latency, about 2,000 requests remain in flight.

Capacity with headroom

nodes = ceil(peak load / safe load per node)provisioned nodes = nodes × headroom factor

Use safe sustained capacity after redundancy, maintenance, and failure reserve.

Cache sizing

RAM ≈ hot items × bytes/item × overhead / target utilization

Include keys, object overhead, replication, and eviction headroom. Estimate hit rate from the access distribution.

URL code length

capacity = alphabet_size ^ code_lengthBase62: choose n where 62ⁿ ≥ record count

62⁷ ≈ 3.52 trillion. Keep reserved words and safety margin in the usable-space estimate.

Snowflake fields

lifespan = (2ᵗ − 1) × tick durationper-node rate = 2ˢ IDs / tick

With t=41 ms bits, lifespan is about 69 years. With s=12, capacity is 4,096 IDs/ms/node.

Quorums

N = replicas · W = write acks · R = read responsesW + R > N ⇒ overlap

Higher W raises write latency. Higher R raises read latency. Failure-domain placement stays essential.

Consistent hashing

keys moved after one node change ≈ K / N

K is key count and N is node count under balanced ownership. Virtual nodes reduce variance.

Sliding window estimate

count ≈ current + previous × remaining fraction

Halfway through a window: current count + 0.5 × previous count.

Availability

TargetDowntime/year
99%3.65 days
99.9%8 h 46 m
99.99%52 m 36 s
99.999%5 m 16 s

Units

1 byte = 8 bits · 1 KB ≈ 10³ B · 1 MB ≈ 10⁶ B1 ms = 10⁻³ s · 1 μs = 10⁻⁶ s · 1 ns = 10⁻⁹ s

Binary powers use KiB, MiB, and GiB. Interview estimates usually benefit from decimal rounding.

Sanity check

result = assumptions × units × time × safety factors

Check order of magnitude, operation mix, replicas, retention, peak factor, and compression.