Skip to content

System Design Notes

Topic-by-topic study notes for system design, based on the System Design Primer.

Core principle: Everything is a trade-off. There is no single "correct" architecture — each decision optimizes for some goals while sacrificing others.


How to Use These Notes

  1. Start with the foundations (files 01–05) to learn the vocabulary of trade-offs: performance vs scalability, latency vs throughput, and availability vs consistency.

  2. Then move through the building blocks (files 06–13): DNS, CDNs, load balancers, reverse proxies, the application layer, databases, caches, and asynchronism.

  3. Review communication and security (14–16).

  4. Keep the appendix (17) handy for back-of-the-envelope estimates.

Study timeline guide

Activity Short Medium Long
Read through all the topics (breadth) ✅ ✅ ✅
Read a few company engineering blog posts ✅ ✅ ✅
Read a few real-world architectures ✅ ✅ ✅
Review the interview approach below ✅ ✅ ✅
Practice interview questions with solutions Some Many Most
Practice object-oriented design questions Some Many Most
Review additional interview questions Some Many Most

How to Approach a System Design Interview Question

The interview is an open-ended conversation — you are expected to lead it.

Step 1 — Outline use cases, constraints, and assumptions

Gather requirements and scope the problem. Ask questions:

  • Who will use it, and how?
  • How many users are there?
  • What does the system do — inputs and outputs?
  • How much data will it handle?
  • How many requests per second?
  • What is the expected read-to-write ratio?

Step 2 — Create a high-level design

Sketch the main components and their connections, and justify your ideas.

Step 3 — Design core components

Dive into detail for each core component. Example (URL shortener):

  • Generating/storing a hash of the full URL (MD5, Base62, hash collisions)
  • SQL vs NoSQL, and the database schema
  • Translating the hashed URL back to the full URL (lookup)
  • API and object-oriented design

Step 4 — Scale the design

Identify and address bottlenecks given your constraints. Consider:

  • Load balancers and horizontal scaling
  • Caching
  • Database sharding

Discuss trade-offs, and address bottlenecks using the principles in these notes.

Back-of-the-envelope calculations

You may need to estimate by hand. Use the appendix for the powers-of-two table and latency numbers every programmer should know.


Index of Topics

# Topic File
1 Performance vs Scalability 01-performance-vs-scalability.md
2 Latency vs Throughput 02-latency-vs-throughput.md
3 Availability vs Consistency (CAP theorem) 03-availability-vs-consistency.md
4 Consistency Patterns 04-consistency-patterns.md
5 Availability Patterns 05-availability-patterns.md
6 Domain Name System (DNS) 06-dns.md
7 Content Delivery Network (CDN) 07-cdn.md
8 Load Balancer 08-load-balancer.md
9 Reverse Proxy 09-reverse-proxy.md
10 Application Layer (Microservices & Service Discovery) 10-application-layer.md
11 Database — RDBMS 11-database-rdbms.md
12 Database — NoSQL & SQL vs NoSQL 12-database-nosql.md
13 Cache 13-cache.md
14 Asynchronism (Queues & Back Pressure) 14-asynchronism.md
15 Communication (TCP, UDP, RPC, REST) 15-communication.md
16 Security 16-security.md
17 Appendix (Estimates & References) 17-appendix.md
18 Walkthrough — Design a URL Shortener 18-walkthrough-url-shortener.md

Top 25 Most Common Interview Questions

The questions most likely to come up, and where to find each one in these notes. The URL shortener has a full step-by-step walkthrough.

Core / entry-level
Question Where to find it
1. Design a URL shortener (TinyURL/Bitly) Full walkthrough, 11 RDBMS
2. Design an API rate limiter 02 Latency vs Throughput
3. Design a key-value store (Redis) 12 NoSQL
4. Design a cache system (Memcached) 13 Cache
5. Design a notification system 14 Asynchronism
Social & media
Question Where to find it
6. Design the Twitter timeline / news feed 11 RDBMS, 13 Cache
7. Design a photo-sharing system (Instagram) 07 CDN
8. Design a social network (graph structures) 12 NoSQL
9. Design a trending-topics system 14 Asynchronism
Infrastructure
Question Where to find it
10. Design a CDN (Cloudflare) 06 DNS, 07 CDN
11. Design a web crawler 14 Asynchronism
12. Design a file-sync service (Dropbox) 01 Performance vs Scalability
13. Design an API gateway 09 Reverse Proxy
14. Design an auth/SSO system 16 Security
Communication & real-time
Question Where to find it
15. Design a chat app (WhatsApp) 10 App Layer, 15 Communication
16. Design Google Docs 04 Consistency, 15 Communication
17. Design a video streaming service (YouTube/Netflix) 07 CDN
18. Design a multiplayer game 15 Communication
Data-heavy & analytics
Question Where to find it
19. Design a search engine (Google) 13 Cache, 12 NoSQL
20. Design search autocomplete / typeahead 13 Cache
21. Design a recommendation system 12 NoSQL
22. Design Amazon's sales ranking 11 RDBMS
23. Design a ride-hailing service (Uber) 10 App Layer
24. Design a stock exchange 02 Latency vs Throughput, 15 Communication
25. Design a system that scales to millions of users 01 Performance vs Scalability, 05 Availability Patterns

Getting Started: Scalability Basics

New to system design? Build a basic understanding of common principles first.

Video: Scalability Lecture at Harvard — covers vertical scaling, horizontal scaling, caching, load balancing, database replication, and database partitioning.

Article: Scalability for Dummies — covers clones (stateless web servers), databases, caches, and asynchronism.