High level design, for interviews and for building things

Study System Design. Worked out.

You have a job, and a Senior or Staff interview somewhere in the next few weeks. An hour in the evening is about what you have got, so each article is one sitting: one system, walked the whole way.

Start with the URL ShortenerSee all articles

Free to read, no signup required.

Argued from the papers and the postmortems, not from blog posts.

Sources cited across the course include PostgreSQL, Apache Kafka, MySQL, Notion, Figma, Pinterest, Google, Meta, Netflix, AWS, Apple, OpenAI, Anthropic, Stripe, Microsoft, Cloudflare, Discord, X, Slack, GitHub.

A bar chart on a logarithmic axis of the load on the backend if the cache is lost, as a multiple of normal: 10 times at a 90 percent hit rate, 100 times at 99 percent, and 1,000 times at 99.9 percent.

Every decision here is argued with a diagram.

Problem Breakdowns

22

One system, designed end to end, the way a 45 minute interview goes.

  1. 01Distributed Rate LimiterUsesApproximate CountingContention and Hot KeysGraceful Degradation+1
    • 108 min read
  2. 02URL ShortenerUsesBijective ID GenerationContention and Hot KeysWorking Set Caching+7
    • 144 min read
  3. 03WhatsApp and Chat SystemsUsesFencing and EpochsContention and Hot KeysFanout on Write against Fanout on Read+3
    • 146 min read
  4. 04News Feed and TimelineUsesContention and Hot KeysFanout on Write against Fanout on Read
    • 79 min read
  5. 05InstagramUsesIdempotency KeysBijective ID GenerationFanout on Write against Fanout on Read+7
    • 90 min read
  6. 06Notification ServiceUsesThe Outbox PatternLeased Quota and Batched CoordinationFanout on Write against Fanout on Read+3
    • 89 min read
  7. 07Live Comments and ReactionsUsesFanout on Write against Fanout on ReadDealing with SkewIdempotency Keys+5
    • 74 min read
  8. 08YouTubeUsesTiered StorageWorking Set CachingContention and Hot Keys+4
    • 68 min read
  9. 09Uber and Ride-HailingUsesIdempotency KeysFencing and EpochsThe Outbox Pattern+3
    • 86 min read
  10. 10Design Yelp (Nearby Places)UsesIdempotency KeysRead Your WritesBackfill and Reprocessing+3
    • 83 min read
  11. 11Ticketmaster and Event Ticket BookingUsesContention and Hot KeysDealing with SkewFencing and Epochs+4
    • 90 min read
  12. 12Design a Payment SystemUsesFencing and EpochsThe Outbox PatternIdempotency Keys+2
    • 79 min read
  13. 13Design an Ad Click AggregatorUsesIdempotency KeysApproximate CountingTiered Storage+4
    • 85 min read
  14. 14Dropbox and Google DriveUsesIdempotency KeysRead Your WritesFanout on Write against Fanout on Read+4
    • 103 min read
  15. 15Design Google Docs (Collaborative Editing)UsesIdempotency KeysFencing and EpochsTiered Storage+3
    • 81 min read
  16. 16Distributed CacheUsesWorking Set CachingContention and Hot KeysDealing with Skew+2
    • 71 min read
  17. 17Design a Distributed Message QueueUsesIdempotency KeysFencing and EpochsTiered Storage+4
    • 81 min read
  18. 18Design a Key-Value StoreUsesIdempotency KeysFencing and EpochsRead Your Writes+3
    • 81 min read
  19. 19Design a Distributed Job SchedulerUsesThe Outbox PatternFencing and EpochsIdempotency Keys+2
    • 84 min read
  20. 20Design a Web CrawlerUsesContention and Hot KeysBackfill and ReprocessingWorking Set Caching+3
    • 86 min read
  21. 21Search Autocomplete and TypeaheadUsesFanout on Write against Fanout on ReadWorking Set CachingBackfill and Reprocessing+4
    • 78 min read
  22. 22Design a Leaderboard / Ranking ServiceUsesIdempotency KeysRead Your WritesFanout on Write against Fanout on Read+5
    • 80 min read

Core Concepts

34

The building blocks behind the designs. Every answer is worked out, not just stated.

  1. 01Back-of-Envelope EstimationNeeded byLatency Numbers That MatterPartitioning and ShardingBloom Filters and Probabilistic Structures+4
    • 68 min read
  2. 02Latency Numbers That MatterNeeded byDistributed CacheSearch Autocomplete and TypeaheadCAP and What It Actually Constrains+9
    • 75 min read
  3. 03CAP and What It Actually ConstrainsNeeded byTicketmaster and Event Ticket BookingConsistency ModelsReplication and Leader Election
    • 70 min read
  4. 04Consistency ModelsNeeded byDropbox and Google DriveDesign Google Docs (Collaborative Editing)Design a Key-Value Store+8
    • 67 min read
  5. 05Partitioning and ShardingNeeded byURL ShortenerNews Feed and TimelineInstagram+15
    • 86 min read
  6. 06Consistent HashingNeeded byLive Comments and ReactionsDesign Google Docs (Collaborative Editing)Distributed Cache+2
    • 74 min read
  7. 07Replication and Leader ElectionNeeded byDesign Google Docs (Collaborative Editing)Design a Distributed Message QueueDesign a Key-Value Store+3
    • 77 min read
  8. 08Quorums, Raft and PaxosNeeded byDesign a Distributed Message QueueDesign a Key-Value StoreDesign a Distributed Job Scheduler
    • 71 min read
  9. 09Caching Strategies and InvalidationNeeded byURL ShortenerNews Feed and TimelineInstagram+8
    • 81 min read
  10. 10Load BalancingNeeded byDistributed Rate LimiterCircuit Breakers, Bulkheads and BackpressureWebSockets, SSE and Polling+2
    • 73 min read
  11. 11CDNs and Edge ComputeNeeded byURL ShortenerInstagramYouTube+4
    • 71 min read
  12. 12Message Queues vs Event StreamsNeeded byWhatsApp and Chat SystemsNotification ServiceLive Comments and Reactions+9
    • 76 min read
  13. 13Idempotency and Exactly-Once DeliveryNeeded byWhatsApp and Chat SystemsNotification ServiceDesign a Payment System+6
    • 70 min read
  14. 14Distributed Transactions and SagasNeeded byUber and Ride-HailingTicketmaster and Event Ticket BookingDesign a Payment System
    • 62 min read
  15. 15Bloom Filters and Probabilistic StructuresNeeded byURL ShortenerDesign an Ad Click AggregatorDesign a Web Crawler
    • 46 min read
  16. 16Circuit Breakers, Bulkheads and Backpressure
    • 45 min read
  17. 17Choosing a DatabaseNeeded byURL ShortenerYouTubeDesign a Payment System+5
    • 69 min read
  18. 18LSM Trees vs B-TreesNeeded byDesign a Key-Value StoreWrite-Ahead LogsInverted Indexes+1
    • 61 min read
  19. 19Indexing and Query PerformanceNeeded byChoosing a DatabaseLSM Trees vs B-TreesInverted Indexes+1
    • 37 min read
  20. 20Write-Ahead LogsNeeded byDesign a Payment SystemDesign Google Docs (Collaborative Editing)Design a Distributed Message Queue+2
    • 59 min read
  21. 21Change Data CaptureNeeded byDesign Yelp (Nearby Places)Design a Leaderboard / Ranking Service
    • 57 min read
  22. 22Inverted IndexesNeeded byDesign Yelp (Nearby Places)
    • 57 min read
  23. 23Geospatial IndexingNeeded byUber and Ride-HailingDesign Yelp (Nearby Places)
    • 62 min read
  24. 24Time-Series StorageNeeded byDesign an Ad Click AggregatorObservability: Metrics, Logs and Traces
    • 57 min read
  25. 25Object and Blob StorageNeeded byInstagramYouTubeDesign Yelp (Nearby Places)+3
    • 60 min read
  26. 26WebSockets, SSE and PollingNeeded byNotification ServiceLive Comments and ReactionsUber and Ride-Hailing+4
    • 53 min read
  27. 27Push Notification DeliveryNeeded byNotification ServiceUber and Ride-Hailing
    • 65 min read
  28. 28Auth: Sessions, JWT and OAuthNeeded bySecurity in System Design
    • 58 min read
  29. 29Multi-Region and Disaster RecoveryNeeded byDesign a Payment SystemDesign a Leaderboard / Ranking Service
    • 57 min read
  30. 30Observability: Metrics, Logs and TracesNeeded byDeployments: Blue-Green and Canary
    • 60 min read
  31. 31Capacity Planning and Autoscaling
    • 57 min read
  32. 32Deployments: Blue-Green and Canary
    • 59 min read
  33. 33Security in System Design
    • 59 min read
  34. 34Cost as a Design Constraint
    • 57 min read

Patterns

16

Ideas that come up again and again. Explained once, linked from every article that uses them.

  1. 01Bijective ID GenerationAppears inURL ShortenerInstagram
    • 19 min read
  2. 02Contention and Hot KeysAppears inDistributed Rate LimiterURL ShortenerWhatsApp and Chat Systems+26
    • 18 min read
  3. 03Approximate CountingAppears inDistributed Rate LimiterURL ShortenerLive Comments and Reactions+3
    • 17 min read
  4. 04Graceful DegradationAppears inDistributed Rate LimiterWhatsApp and Chat SystemsInstagram+34
    • 16 min read
  5. 05Leased Quota and Batched CoordinationAppears inDistributed Rate LimiterURL ShortenerWhatsApp and Chat Systems+2
    • 22 min read
  6. 06Read Your WritesAppears inURL ShortenerLive Comments and ReactionsDesign Yelp (Nearby Places)+12
    • 17 min read
  7. 07Fanout on Write against Fanout on ReadAppears inWhatsApp and Chat SystemsNews Feed and TimelineInstagram+8
    • 16 min read
  8. 08Idempotency KeysAppears inURL ShortenerWhatsApp and Chat SystemsInstagram+20
    • 14 min read
  9. 09The Outbox PatternAppears inNotification ServiceUber and Ride-HailingTicketmaster and Event Ticket Booking+10
    • 27 min read
  10. 10Working Set CachingAppears inURL ShortenerInstagramYouTube+11
    • 15 min read
  11. 11Tiered StorageAppears inURL ShortenerInstagramYouTube+9
    • 17 min read
  12. 12Backfill and ReprocessingAppears inURL ShortenerInstagramYouTube+11
    • 17 min read
  13. 13Denylist Push against Cache PurgeAppears inURL ShortenerInstagramLive Comments and Reactions+7
    • 16 min read
  14. 14Dealing with SkewAppears inInstagramLive Comments and ReactionsYouTube+18
    • 15 min read
  15. 15Fencing and EpochsAppears inWhatsApp and Chat SystemsUber and Ride-HailingTicketmaster and Event Ticket Booking+12
    • 15 min read
  16. 16Dual Write MigrationAppears inPartitioning and ShardingMessage Queues vs Event StreamsIdempotency and Exactly-Once Delivery+3
    • 15 min read

Interview Craft

5

How the 45 minutes is actually scored, and the ways strong engineers still lose it.

  1. 01How a System Design Interview Is Scored
    • 23 min read
  2. 02The First Five Minutes: Requirements
    • 23 min read
  3. 03What Separates Mid, Senior and Staff
    • 23 min read
  4. 04Drawing Diagrams Under Time Pressure
    • 22 min read
  5. 05The Ten Most Common Ways Candidates Fail
    • 22 min read

More coming soon.

Article

Send feedback

Thank you for helping. We read every report and fix what is wrong.

How do you feel about oneby7?

Sign in to oneby7

Keep your progress, your streak and your code, on any device.

New here? This creates your account too.