System Design Interview

Dated Jul 12, 2025; last modified on Sat, 12 Jul 2025

System Design Interview. Alex Xu. ISBN: 979-8664653403 .
  • Scale from Zero to Millions of Users: single-server setup; database; vertical scaling vs. horizontal scaling; load balancer; database replication; cache; content delivery network (CDN); stateless web tier; data centers; message queue; logging, metrics, and automation; database scaling.
  • Back-of-the-envelope Estimation: power of 2; latency numbers every programmer should know; availability numbers.
  • A Framework for System Design Interviews: understand the problem and establish design scope; propose high-level design and get buy-in; design deep dive; wrap up.
  • Design a Rate Limiter: where to put the rate limiter; algorithms for rate limiting (token bucket, leaking bucket, fixed window counter, sliding window log, sliding window counter); rate-limiting rules; exceeding the rate limit; rate limiter in a distributed environment; performance optimization; monitoring.
  • Design Consistent Hashing: the rehashing problem; hash space and hash ring; hash servers; hash keys; adding a server; removing a server; virtual nodes; find affected keys.
  • Design a Key-Value Store: single-server key-value store; distributed key-value store (consistency, availability, partition tolerance); real-world distributed systems; data partition; data replication; consistency; inconsistency resolution; handling failures; system architecture diagram; write path; read path.
  • Design a Unique ID Generator in Distributed Systems: multi-master replication; UUIDs; ticket server; Twitter snowflake approach; timestamp; sequence number.
  • Design a URL Shortener: back of the envelope estimation; API endpoints; URL redirecting; URL shortening; data model; hash function.
  • Design a Web Crawler: back of the envelope estimation; seed URLs; URL frontier; HTML downloader; DNS resolver; content parser; content seen?; content storage; URL extractor; URL filter; URL storage; web crawler workflow; depth-first search vs. breadth-first search; distributed crawl; cache DNS resolver; locality; short timeout; robustness; extensibility; detect and avoid problematic content.
  • Design a Notification System: notification types (push, SMS, email); contact gathering flow; notification send/receiving flow; prevent data loss; exactly one delivery?; notification template; notification setting; rate limiting; retry mechanism; security in push notifications; monitor queued notifications; events tracking.
  • Design a News Feed System: newsfeed APIs; feed publishing; web servers; fanout service; newsfeed building; newsfeed retrieval; cache architecture.
  • Design a Chat System: polling; long-polling; web socket; stateless vs. stateful services; 3P integration; scalability; storage; message table for 1:1 chat; message table for group chat; service discovery; message flows; message synchronization; online presence.
  • Design a Search Autocomplete System: query service; trie data structure; limit max length of a prefix; cache top queries at each node; data gathering service; aggregators; trie operations; scaling storage.
  • Design YouTube: video uploading flow; video streaming flow; video transcoding; directed acyclic graph (DAG) model; parallel video uploading; place upload centers close to users; parallelism everywhere; pre-signed upload URLs; protecting copyrighted videos; content delivery network; error handling.
  • Design Google Drive: APIs; move away from single server; sync conflicts; block servers; high consistency; metadata database; upload flow; download flow; notification service; save storage space; failure handling.
  • The Learning Continues: