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.
- 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.
- 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.
- 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.
- 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).
- 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).
- 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.
- 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.
- 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.
- 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.
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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
Related reading
Standalone posts that come up often in backend interviews.
- 10 backend design patterns senior engineers use, in Java 21 and Spring Boot
Repository, Factory, Singleton, Strategy, Observer, Builder, Adapter, Decorator, CQRS and Circuit Breaker in tested Java 21 and Spring Boot code, with pitfalls.
- Idempotency keys: how payment APIs make retries safe
Notes on how APIs like Stripe use idempotency keys so clients can retry failed requests without charging a customer twice, plus a minimal implementation.
- Caching in Spring Boot with Redis and RedisTemplate
How to integrate Redis as a caching layer in a Spring Boot application using RedisTemplate to reduce database load and response times, step by step with code.