System design

From a crash course on why each part of a web architecture exists, through core concepts and deep dives, to patterns and full worked designs. Includes a framework for ML system design interviews.

Essentials

  • System Design Interviews: The Quick Start

    Know which system design interview you face and how depth expectations change by level, then deliver any design with a six-step, 45-minute framework whose estimates drive real decisions.

    7 min read

  • ML System Design Interviews: The Quick Start

    Run an ML system design interview with an eight-step, 45-minute framework, from framing and labels to metrics, serving, drift and feedback loops, worked through on a harmful-comment classifier.

    9 min read

Crash course

Core concepts

  • Scaling Data: Replication, Partitioning and Consistency

    Pick and defend a partition key, handle hot keys, explain leader-follower, multi-leader and quorum replication, state CAP and PACELC correctly, and match a consistency guarantee to each feature.

    8 min read

  • API Design in a System Design Interview

    Write a small, defensible API in five minutes, with resources, cursor pagination, idempotency keys, errors, versioning and a reasoned choice of REST, RPC, GraphQL or streaming, and answer the follow-ups it triggers.

    8 min read

  • Data Modeling for System Design Interviews

    Turn requirements into entities and access patterns, choose keys and indexes for the queries that matter, and denormalize for the read path with a stated update path.

    8 min read

Deep dives

  • How to Run a Deep Dive in a System Design Interview

    Pick the riskiest part of your design and work through it in five steps (numbers, options, trade-off, decision, failure mode), with a chat message fan-out as the worked example.

    9 min read

  • Choosing and Scaling a Database

    Choose a database from the data's access patterns, explain how indexes, replicas and shards change performance and what each costs, and walk through two storage decisions with numbers.

    8 min read

  • Caching in Depth

    Place a cache, choose its read and write pattern, TTL and eviction, handle stampedes, hot keys and lookups for missing keys, and calculate how much load it takes off the database.

    8 min read

  • Load Balancing in Depth

    Choose between Layer 4 and Layer 7, match the algorithm to the traffic, design health checks, drain long-lived connections, remove the load balancer as a single point of failure, and route users across regions.

    8 min read

  • Queues and Event Streams in Depth

    Choose between a message queue and an event log, state delivery semantics and ordering scope, size partitions and consumers, and handle lag, poison messages and the dual-write problem.

    9 min read

  • Search and Geospatial Indexes in Depth

    Explain inverted indexes, analyzers and ranking, keep a search index in sync with change data capture, support partial-word search, and size a find-nearby feature with geohashes or quadtrees.

    8 min read

Patterns

  • Scaling Reads

    Apply the read-scaling moves in order (fix queries, denormalize, add replicas, cache, precompute), check each against a read-rate estimate, and handle replication lag and hot keys.

    8 min read

  • Scaling Writes

    Raise write capacity by writing less, splitting latest state from history, batching behind a durable log, sharding by the write key and splitting hot counters, and size bursts and backpressure with real arithmetic.

    8 min read

  • Real-Time Updates

    Choose between polling, long polling, server-sent events and WebSockets, route each update to the server holding the recipient's connection, and handle ordering, reconnection, missed messages and presence.

    7 min read

  • Dealing with Contention: When Everyone Wants the Last Seat

    Work out how many updates per second a hot row can take, then pick and defend the right fix: pessimistic or optimistic locking, atomic conditional updates, expiring holds, fenced distributed locks, queues or split stock.

    8 min read

  • Multi-Step Processes and Long-Running Jobs

    Design flows that span services so they finish or cleanly undo themselves, with sagas, compensations, idempotent retries, the outbox pattern and durable workflows, and run long jobs with status, heartbeats and dead-letter queues.

    8 min read

  • Handling Large Files: Uploads, Processing and Delivery

    Keep large files off your API servers with presigned and resumable multipart uploads, keep metadata and stored bytes consistent, process files after upload, and deliver them through a CDN with range requests.

    7 min read

Problem breakdowns

  • Design a Ticket Booking System

    Design event ticketing end to end: hold seats without double-selling, absorb a million-fan on-sale with a virtual waiting room, serve availability from cache, and handle a payment that succeeds after its hold expired.

    9 min read

  • Design a News Feed

    Build a social feed end to end, choosing fan-out on write, on read or a hybrid from the read and write numbers, sizing the feed cache, and handling celebrity accounts, pagination and ranking.

    7 min read