Interview Prep

Study notes for backend and system design interviews, written as ordered series. Start at Part 1 of a series and read on, or jump to a topic. 22 posts so far.

System design deep dives

Nine write-ups of systems and papers from big tech: how Discord, Slack, Facebook, Amazon, Google and others solved storage, caching, consensus and transaction problems at scale.

  1. Part 1
    How Discord stores trillions of messages: from MongoDB to Cassandra to ScyllaDB

    How Discord moved chat history from MongoDB to Cassandra to ScyllaDB: time-bucketed partitions, tombstone traps, hot partitions, and Rust request coalescing.

    14 min read
  2. Part 2
    Scaling Slack’s job queue: Kafka in front of Redis

    Slack put Kafka in front of Redis so enqueue stays up when workers stall: durable buffering, Kafkagate, JQRelay rate limits, and incremental migration.

    7 min read
  3. Part 3
    Scaling Memcache at Facebook: leases, Gutter, and commit-log invalidation

    How Facebook scaled memcached to billions of requests per second: leases against thundering herds, Gutter pools, mcsqueal invalidation, and remote markers.

    8 min read
  4. Part 4
    TAO: Facebook’s social graph store — objects, associations, and refill

    How Facebook's TAO served a billion graph reads/sec: objects & associations, leader/follower caches, refill messages, and master/slave regions (ATC '13).

    7 min read
  5. Part 5
    Dynamo: Amazon’s always-writeable key-value store, explained

    How Amazon's 2007 Dynamo kept carts writable: consistent hashing, sloppy quorums, hinted handoff, vector clocks, Merkle anti-entropy, and gossip (SOSP '07).

    12 min read
  6. Part 6
    Raft: how a few servers agree on one log, explained

    How Raft keeps a replicated log consistent: terms, randomized elections, log matching, the Figure 8 commit rule, joint consensus, snapshots, linearizable reads.

    11 min read
  7. Part 7
    Spanner: TrueTime, commit wait and external consistency, explained

    How Google Spanner orders transactions worldwide: TrueTime intervals, commit wait, Paxos groups, two-phase commit over Paxos, safe time and lock-free reads.

    10 min read
  8. Part 8
    Amazon Aurora: the log is the database, explained

    How Amazon Aurora ships only redo log records to six-way storage across three AZs, then commits, reads and changes membership without distributed consensus.

    13 min read
  9. Part 9
    FoundationDB: unbundled transactions and simulation testing, explained

    How FoundationDB splits a database into narrow roles, commits with lock-free OCC and MVCC, keeps f+1 log copies, and treats every failure as a fast recovery.

    11 min read

System design interview questions

Thirteen practice questions, from a rate limiter up to ad click aggregation, each with the scenario, the assumptions, a time budget and an outline of what a strong answer covers.

  1. Part 1
    System design interview: design a distributed rate limiter

    Practice question: a distributed rate limiter for API gateways. Scenario, assumptions, time budget and an outline of what a strong answer covers.

    3 min read
  2. Part 2
    System design interview: design a distributed cache

    Practice question: a distributed in-memory cache in front of databases. Scenario, assumptions, time budget and an outline of what a strong answer covers.

    4 min read
  3. Part 3
    System design interview: design a notification system

    Practice question: a push, email, SMS and in-app notification service with priorities and preferences. Scenario, time budget and answer outline.

    5 min read
  4. Part 4
    System design interview: design search autocomplete (type-ahead)

    Practice question: type-ahead suggestions that feel instant on every keystroke. Scenario, assumptions, time budget and an outline of a strong answer.

    5 min read
  5. Part 5
    System design interview: design a chat and messaging system

    Practice question: 1:1 and group chat with presence, receipts and offline delivery across devices. Scenario, time budget and answer outline.

    5 min read
  6. Part 6
    System design interview: design a news feed

    Practice question: publishing posts, building each user’s home feed and paginating it. Scenario, assumptions, time budget and answer outline.

    5 min read
  7. Part 7
    System design interview: design a distributed job scheduler

    Practice question: a multi-tenant scheduler for delayed and cron-style jobs that fires on time. Scenario, time budget and an outline of a strong answer.

    5 min read
  8. Part 8
    System design interview: design ride-hailing: matching and location

    Practice question: live driver location tracking and rider-to-driver matching. Scenario, assumptions, time budget and an outline of a strong answer.

    6 min read
  9. Part 9
    System design interview: design a payment ledger

    Practice question: a double-entry ledger for wallets, sellers, fees and processors. Idempotency, hot accounts and reconciliation. Scenario and answer outline.

    6 min read
  10. Part 10
    System design interview: design a collaborative document editor

    Practice question: real-time collaborative rich-text editing, merging concurrent edits. Scenario, assumptions, time budget and an outline of a strong answer.

    5 min read
  11. Part 11
    System design interview: design a global URL shortener

    Practice question: a multi-region URL shortener with fast redirects and near-real-time click analytics. Scenario, time budget and answer outline.

    6 min read
  12. Part 12
    System design interview: design a web crawler at scale

    Practice question: a distributed crawler with politeness, deduplication, traps and recrawl. Scenario, assumptions, time budget and an outline of a strong answer.

    6 min read
  13. Part 13
    System design interview: design ad click aggregation

    Practice question: exactly-once click counting, event-time windows and late data for dashboards and billing. Scenario, time budget and answer outline.

    5 min read

Standalone posts that come up often in backend interviews.