High-Level Design
Design large-scale distributed systems: how to break a product into services, store and move data, and keep it fast and reliable as traffic grows.
What you will learn
- Drive a 45-minute design interview with a repeatable framework
- Estimate traffic, storage and bandwidth to justify design choices
- Reason about trade-offs between consistency, availability and latency
- Pick the right building block — cache, queue, database, CDN — and defend it
- Present complete, defensible designs for the most-asked interview problems
Foundations
The method and the vocabulary. Read these first — every later lesson assumes them.
- The HLD Interview Framework: A step-by-step method for running a design interview, from requirements to deep dives.
- Back-of-the-Envelope Estimation: Numbers every engineer should know and how to turn them into QPS, storage and bandwidth.
- Networking Essentials: DNS, TCP vs UDP, HTTP versions and TLS — what actually happens between client and server.
Scaling the Application Tier
How a single server becomes a fleet, and how traffic is spread across it.
- Scalability: Vertical vs Horizontal: Scaling up vs out, stateless services, and where state should live.
- Load Balancing: L4 vs L7, balancing algorithms, health checks, and avoiding a single point of failure.
Storing Data
The database is usually the hardest part to scale. Choosing, indexing, protecting, copying and splitting data.
- Choosing a Database: SQL vs NoSQL: Relational, key-value, document, wide-column and graph stores — and how to choose.
- Indexing & Storage Engines: B-Trees vs LSM-Trees, secondary indexes, and why writes and reads pull in opposite directions.
- Transactions, Isolation & MVCC: ACID in practice, isolation anomalies, MVCC, locking and optimistic concurrency.
- Replication: Leader-follower, multi-leader and leaderless replication, replication lag and failover.
- Partitioning & Sharding: Splitting data across machines: range vs hash partitioning, hot spots and rebalancing.
- Consistent Hashing: The hash ring, virtual nodes, and why adding a server should not reshuffle everything.
- Object Storage & File Uploads: How S3-style storage works, presigned URLs, multipart and resumable uploads.
Distributed Systems Theory
The rules of the game once data and work live on more than one machine.
- CAP Theorem & PACELC: What CAP really says, what it does not, and the latency trade-off PACELC adds.
- Consistency Models: Linearizability, sequential, causal, read-your-writes and eventual consistency — and quorums.
- Time, Clocks & Ordering: Clock skew, Lamport clocks, vector clocks and hybrid logical clocks.
- Consensus, Leader Election & Locks: Raft, ZooKeeper/etcd, leases, fencing tokens, gossip and failure detection.
- Distributed Transactions: Two-phase commit, Sagas, the outbox pattern and idempotent workflows.
- Unique ID Generation: UUIDs, ticket servers, Snowflake IDs and ULID/UUIDv7.
Caching & Content Delivery
Serving data faster by keeping copies closer to where they are needed.
- Caching: Cache layers, read/write strategies, eviction, invalidation, and stampedes.
- Content Delivery Networks: Edge caching, push vs pull CDNs, cache keys and invalidation for static and dynamic content.
Services & Communication
How clients talk to servers, how services talk to each other, and how to split a system into services.
- API Design: REST, gRPC, GraphQL: Resource modelling, pagination, versioning, idempotency and choosing a protocol.
- Real-Time Communication: Short polling, long polling, Server-Sent Events and WebSockets — and scaling persistent connections.
- Message Queues & Event Streaming: Queues vs logs, delivery guarantees, ordering, consumer groups and back-pressure.
- Monoliths, Microservices & Service Discovery: When to split, service boundaries, discovery, API gateways and service meshes.
- Event-Driven Architecture, CQRS & Event Sourcing: Events vs commands, choreography vs orchestration, CQRS and event sourcing.
Data Processing & Specialised Systems
Analytics pipelines, search, location, and the clever data structures behind them.
- Batch & Stream Processing: OLTP vs OLAP, MapReduce/Spark, Flink, windows, watermarks, Lambda and Kappa.
- Search & Inverted Indexes: Tokenisation, inverted indexes, relevance ranking, and running Elasticsearch at scale.
- Geospatial Indexing: Geohashes, quadtrees, S2 and H3 — finding what is nearby, fast.
- Probabilistic Data Structures: Bloom filters, HyperLogLog, Count-Min Sketch and top-K heavy hitters.
Reliability, Security & Operations
Keeping the system up, secure and observable — in one region or many.
- Rate Limiting: Token bucket, leaky bucket, fixed and sliding windows, and distributed rate limiting.
- Availability & Fault Tolerance: SLAs and nines, redundancy, timeouts, retries with backoff, circuit breakers and idempotency.
- Observability: Metrics, logs, traces, SLO-based alerting and debugging distributed systems.
- Multi-Region Architecture: Active-passive vs active-active, data placement, global routing and disaster recovery.
- Security Fundamentals: Authentication, authorization, OAuth 2.0/OIDC, JWTs, encryption and secrets.
Case Studies: Core
The most frequently asked designs, written the way you would present them in an interview.
- Design a URL Shortener: Key generation, redirects at scale, caching and analytics.
- Design a Distributed Rate Limiter: A rate-limiting service shared by many API servers.
- Design a Notification System: Multi-channel delivery, preferences, retries and deduplication.
- Design Search Autocomplete: Tries, top-k precomputation, freshness and personalisation.
- Design a Web Crawler: URL frontier, politeness, deduplication and recrawl scheduling.
- Design a News Feed: Fan-out on write vs read, ranking and celebrity users.
- Design a Chat System: WebSockets, message ordering, presence, groups and offline delivery.
- Design Cloud File Storage (Dropbox): Chunking, deduplication, sync, conflicts and metadata.
- Design a Real-Time Leaderboard: Sorted sets, O(log n) ranks, ties, monthly boards and sharding by score.
Case Studies: Advanced
Senior-level designs with hard consistency, scale or real-time requirements.
- Design a Ride-Hailing Service: Location updates, geo-indexing, matching and trip state.
- Design a Video Streaming Platform: Upload pipeline, transcoding, adaptive bitrate and CDN delivery.
- Design a Ticket Booking System: Seat holds, contention, virtual waiting rooms and payments.
- Design a Payment System: Ledgers, idempotency, PSP integration and reconciliation.
- Design an Ad Click Aggregator: Stream aggregation, exactly-once counting and reconciliation.
- Design a Distributed Job Scheduler: Scheduling at scale, leases, retries and exactly-once execution.
- Design a Collaborative Editor (Google Docs): OT vs CRDTs, sessions, presence and persistence.
- Design a Distributed Key-Value Store: Partitioning, replication, quorums, repair and storage engine.
- Design a Distributed Message Queue (Kafka): Partitioned logs, replication and ISR, consumer groups and delivery semantics.
- Design Metrics Monitoring & Alerting: Time-series storage and compression, cardinality, rollups and reliable alerting.
- Design a Stock Exchange: Order books, price-time matching, sequencing, determinism and low latency.
Revision
Consolidate everything before an interview.
- Recurring Design Patterns: The ten problem shapes behind almost every design question, and the standard answers.
- HLD Cheat Sheet: Numbers, trade-offs and decision tables on one page for last-minute revision.