title: HLD fundamentals description: The building blocks of system design interviews: framework, estimation, networking, storage, replication, partitioning, consistency, messaging, resilience and more.
HLD fundamentals¶
These are the building blocks every system design answer is assembled from: the 45-minute framework, estimation, networking, load balancing, caching, databases and storage engines, replication and partitioning, transactions, consistency models, messaging, consensus, resilience, observability and security. Each page ends with how to raise the topic in the room, the follow-up questions interviewers ask and a self-check. Read the P0 pages in order before your first case study; they introduce the vocabulary and the default architecture every case study extends. Pages with a Python implementation ship a tested module under code/hld/ that you can run and modify.
Tiers: P0 must be solid before any interview, P1 is expected of a strong SDE2, P2 is stretch material for when the rest is done.
Start here (P0)¶
- The 45-minute HLD framework
- Back-of-envelope estimation
- From one server to millions of users
- Networking for system design
- API design for HLD rounds
- Load balancing, reverse proxies and API gateways
- Caching and CDNs
- Choosing a database
- Replication
- Partitioning, sharding and consistent hashing
- Transactions, 2PC, sagas and idempotency
- CAP, PACELC and consistency models
- Messaging, queues and Kafka internals
- Rate limiting
- Resilience patterns
All pages¶
| # | Page | Tier | Covers |
|---|---|---|---|
| 1 | The 45-minute HLD framework | P0 | Steps: functional + non-functional requirements (scale, latency, consistency, durability, out of scope); estimation; API; data model; v1… |
| 2 | Back-of-envelope estimation | P0 | Latency ladder (2025-era ranges, no false precision); powers of two; availability nines table; formulas DAU to avg QPS, peak 2-5x, storage… |
| 3 | From one server to millions of users | P0 | Progressive evolution: single box, separate DB, LB + stateless web tier, read replicas, cache, CDN, queue + workers, sharding, multi-DC and… |
| 4 | Networking for system design | P0 | DNS (recursion, TTL, GeoDNS, anycast); TCP vs UDP (handshake, head-of-line blocking); TLS 1.3 handshake; HTTP/1.1 keep-alive vs HTTP/2… |
| 5 | API design for HLD rounds | P0 | Resource modeling, naming, verbs and status codes, versioning (path vs header), pagination (offset vs cursor/keyset, opaque cursors)… |
| 6 | Load balancing, reverse proxies and API gateways | P0 | L4 vs L7; algorithms (round robin, weighted RR, least connections, least response time, IP hash, consistent hash); health checks (active… |
| 7 | Caching and CDNs | P0 | Where to cache (browser, CDN, gateway, app-local, distributed, DB buffer); cache-aside, read-through, write-through, write-back… |
| 8 | Choosing a database | P0 | Relational model, normalization vs denormalization, ACID, indexes, join cost at scale; NoSQL families (key-value, wide-column, document… |
| 9 | Storage engines and indexing | P1 | B-tree and B+tree (page splits, write-in-place, read-optimized); LSM (memtable, WAL, SSTables, size-tiered vs leveled compaction, Bloom… |
| 10 | Replication | P0 | Single-leader, multi-leader, leaderless; sync, async, semi-sync; replication lag anomalies and fixes (read-your-writes, monotonic reads… |
| 11 | Partitioning, sharding and consistent hashing | P0 | Range vs hash partitioning; hotspots (celebrity, skew) and salting or compound keys; partitioning secondary indexes (local vs global)… |
| 12 | Transactions, 2PC, sagas and idempotency | P0 | ACID; isolation levels and anomalies (dirty read, non-repeatable read, phantom, lost update, write skew); MVCC, 2PL, optimistic concurrency… |
| 13 | CAP, PACELC and consistency models | P0 | CAP stated correctly (partitions are not optional; CP vs AP only under partition), PACELC; consistency spectrum: linearizable, sequential… |
| 14 | Messaging, queues and Kafka internals | P0 | Queue vs pub/sub vs log; Kafka anatomy (topics, partitions, offsets, consumer groups, ISR, acks, retention, compaction, partition-key… |
| 15 | Consensus and coordination | P1 | Why consensus (leader election, atomic broadcast, configuration); FLP intuition; Paxos intuition; Raft (terms, election, log replication… |
| 16 | Time, clocks and ordering | P1 | Wall-clock vs monotonic clocks, NTP drift, leap seconds; Lamport timestamps; vector clocks and version vectors (detecting concurrency)… |
| 17 | Probabilistic data structures | P1 | Bloom filter (sizing m and k, false-positive rate), counting Bloom, cuckoo filter mention; Count-Min Sketch (heavy hitters, error bounds)… |
| 18 | Rate limiting | P0 | Token bucket, leaky bucket, fixed window, sliding window log, sliding window counter (trade-off table); distributed limiting (Redis atomic… |
| 19 | Resilience patterns | P0 | Timeouts (connect, read, budgets); retries with exponential backoff and jitter (full, equal, decorrelated), retry budgets and retry storms… |
| 20 | Monolith, microservices, CQRS and event sourcing | P1 | Monolith vs modular monolith vs microservices (when to split, Conway); service discovery (client-side, server-side, DNS, Consul, etcd); API… |
| 21 | Object, file, search, time-series and graph storage | P1 | Object storage (buckets, flat namespace, erasure coding vs replication, multipart upload, presigned URLs, consistency); distributed file… |
| 22 | Security essentials | P1 | Authn vs authz; sessions vs JWT (revocation, refresh tokens, rotation); OAuth2 (authorization code + PKCE, client credentials) and OIDC… |
| 23 | Observability, SLOs and error budgets | P1 | Logs, metrics, traces; structured logging and correlation IDs; distributed tracing (spans, context propagation, OpenTelemetry); metric… |
| 24 | Geospatial indexing | P1 | Latitude/longitude, haversine; bounding-box queries; geohash (base32, precision table, neighbors, boundary problem); quadtree; R-tree… |
| 25 | Batch and stream processing | P1 | MapReduce (map, shuffle, reduce; word count); Spark (DAG, in-memory); Flink and Kafka Streams (event time vs processing time, watermarks… |
| 26 | Deployments, feature flags and data migrations | P2 | Rolling, blue-green, canary; feature flags; schema migrations (expand/contract); dual writes + backfill + verification + cutover… |
| 27 | Classic papers digest | P2 | One H3 per paper: GFS, MapReduce, Bigtable, Dynamo, Cassandra, Kafka, ZooKeeper, Spanner, Raft, Chubby, Scaling Memcache at Facebook, TAO… |