Cheatsheets
System design
Scaling, caching, databases, load balancing, messaging, and estimation — with a reference diagram.
Visualize
Consistent hashing — the ring (3D)
Keys belong to the next node clockwise; adding a node remaps only ~1/N of the keys.
LRU cache
The least-recently-used entry is evicted when the cache is full.
MISS — load A at the front.
26 entries
Scaling5
Vertical vs horizontalBigger box vs more boxes
Stateless servicesAny instance serves any request → easy scale
Sharding / partitioningSplit data across nodes by key
ReplicationCopies for read scaling & failover
AutoscalingAdd/remove capacity on demand
Caching5
CDNCache static assets at the edge
Cache-asideApp reads cache first; on miss, read DB and fill cache.
Write-through / behindWrite to cache then DB (sync/async)
TTL + invalidationHardest problem — expire & bust stale data
Redis / MemcachedIn-memory key-value stores
Databases5
SQL vs NoSQLRelational/ACID vs flexible/scale-out
CAP theoremUnder a network partition, pick consistency or availability.
Read replicasOffload reads from the primary
IndexingSpeed reads; cost writes & storage
Connection poolingReuse DB connections under load
Traffic & messaging6
L4 vs L7 LBTransport vs application-aware routing
Round robin / least-connLoad balancing strategies
Queues / pub-subDecouple & smooth bursty work
Dead-letter queuePark messages that keep failing
BackpressureSlow producers when consumers lag
IdempotencySafe retries — the same request applied twice has one effect.
Estimation & reliability5
Back-of-envelopeRecipe: size QPS, storage, and bandwidth before designing.
Latency numbersOrder-of-magnitude latencies every engineer should know.
p99 latencyOptimise tail, not just the average
SLA / SLO / SLITargets, objectives, indicators
Graceful degradationShed load, serve stale, keep the core path up.