# The System Design Primer, as a course > Donne Martin's The System Design Primer (CC BY 4.0), the guide to designing large-scale systems, reorganized into 35 chapters: core trade-offs, building blocks from DNS to databases, and worked system design and object-oriented design interview questions. Also 16 extra chapters written for this site on topics the primer doesn't cover, such as rate limiting, consistent hashing and consensus. Each chapter is available as Markdown at `/learn/.md`, and the whole course is in one file at [llms-full.txt](https://system.tangentbyte.com/llms-full.txt). Chapters in the "Beyond the primer" parts are written for this site, not by the primer's author. ## Start here - [Motivation](https://system.tangentbyte.com/learn/motivation.md): Learning how to design scalable systems will help you become a better engineer. - [Study guide](https://system.tangentbyte.com/learn/study-guide.md): Q: For interviews, do I need to know everything here? - [How to approach a system design interview question](https://system.tangentbyte.com/learn/how-to-approach-a-system-design-interview-question.md): The system design interview is an open-ended conversation. You are expected to lead it. - [System design topics: start here](https://system.tangentbyte.com/learn/system-design-topics-start-here.md): First, you'll need a basic understanding of common principles, learning about what they are, how they are used, and their pros and cons. ## Core trade-offs - [Performance vs scalability](https://system.tangentbyte.com/learn/performance-vs-scalability.md): A service is scalable if it results in increased performance in a manner proportional to resources added. Generally, increasing performance means serving more units of work, but… - [Latency vs throughput](https://system.tangentbyte.com/learn/latency-vs-throughput.md): Latency is the time to perform some action or to produce some result. - [Availability vs consistency](https://system.tangentbyte.com/learn/availability-vs-consistency.md): In a distributed computer system, you can only support two of the following guarantees: - [Consistency patterns](https://system.tangentbyte.com/learn/consistency-patterns.md): With multiple copies of the same data, we are faced with options on how to synchronize them so clients have a consistent view of the data. Recall the definition of consistency… - [Availability patterns](https://system.tangentbyte.com/learn/availability-patterns.md): There are two complementary patterns to support high availability: fail-over and replication. ## Building blocks - [Domain name system](https://system.tangentbyte.com/learn/domain-name-system.md): A Domain Name System (DNS) translates a domain name such as www.example.com to an IP address. - [Content delivery network](https://system.tangentbyte.com/learn/content-delivery-network.md): A content delivery network (CDN) is a globally distributed network of proxy servers, serving content from locations closer to the user. Generally, static files such as… - [Load balancer](https://system.tangentbyte.com/learn/load-balancer.md): Load balancers distribute incoming client requests to computing resources such as application servers and databases. In each case, the load balancer returns the response from the… - [Reverse proxy (web server)](https://system.tangentbyte.com/learn/reverse-proxy-web-server.md): A reverse proxy is a web server that centralizes internal services and provides unified interfaces to the public. Requests from clients are forwarded to a server that can fulfill… - [Application layer](https://system.tangentbyte.com/learn/application-layer.md): Separating out the web layer from the application layer (also known as platform layer) allows you to scale and configure both layers independently. Adding a new API results in… - [Database](https://system.tangentbyte.com/learn/database.md): A relational database like SQL is a collection of data items organized in tables. - [Cache](https://system.tangentbyte.com/learn/cache.md): Caching improves page load times and can reduce the load on your servers and databases. In this model, the dispatcher will first lookup if the request has been made before and try… - [Asynchronism](https://system.tangentbyte.com/learn/asynchronism.md): Asynchronous workflows help reduce request times for expensive operations that would otherwise be performed in-line. They can also help by doing time-consuming work in advance,… - [Communication](https://system.tangentbyte.com/learn/communication.md): HTTP is a method for encoding and transporting data between a client and a server. It is a request/response protocol: clients issue requests and servers issue responses with… - [Security](https://system.tangentbyte.com/learn/security.md): This section could use some updates. Consider contributing! ## Reference - [Appendix](https://system.tangentbyte.com/learn/appendix.md): You'll sometimes be asked to do 'back-of-the-envelope' estimates. For example, you might need to determine how long it will take to generate 100 image thumbnails from disk or how… ## System design questions - [Design Pastebin.com (or Bit.ly)](https://system.tangentbyte.com/learn/design-pastebin.md): Covers: User enters a block of text and gets a randomly generated link; User enters a paste's url and views the contents; User is anonymous - [Design the Twitter timeline and search](https://system.tangentbyte.com/learn/design-twitter.md): Covers: User posts a tweet; User views the user timeline (activity from the user); User views the home timeline (activity from people the user is following) - [Design a web crawler](https://system.tangentbyte.com/learn/design-web-crawler.md): Covers: Service crawls a list of urls:; User inputs a search term and sees a list of relevant pages with titles and snippets the crawler generated; Service has high availability - [Design Mint.com](https://system.tangentbyte.com/learn/design-mint.md): Covers: User connects to a financial account; Service extracts transactions from the account; Service recommends a budget - [Design the data structures for a social network](https://system.tangentbyte.com/learn/design-social-graph.md): Covers: User searches for someone and sees the shortest path to the searched person; Service has high availability - [Design a key-value cache to save the results of the most recent web server queries](https://system.tangentbyte.com/learn/design-query-cache.md): Covers: User sends a search request resulting in a cache hit; User sends a search request resulting in a cache miss; Service has high availability - [Design Amazon's sales rank by category feature](https://system.tangentbyte.com/learn/design-sales-rank.md): Covers: Service calculates the past week's most popular products by category; User views the past week's most popular products by category; Service has high availability - [Design a system that scales to millions of users on AWS](https://system.tangentbyte.com/learn/design-scaling-aws.md): Covers: User makes a read or write request; Service needs to evolve from serving a small amount of users to millions of users; Service has high availability ## Object-oriented design questions - [Design a hash map](https://system.tangentbyte.com/learn/ood-hash-table.md) - [Design an LRU cache](https://system.tangentbyte.com/learn/ood-lru-cache.md) - [Design a call center](https://system.tangentbyte.com/learn/ood-call-center.md) - [Design a deck of cards](https://system.tangentbyte.com/learn/ood-deck-of-cards.md) - [Design a parking lot](https://system.tangentbyte.com/learn/ood-parking-lot.md) - [Design an online chat](https://system.tangentbyte.com/learn/ood-online-chat.md) ## Beyond the primer: concepts - [Back-of-the-envelope estimation](https://system.tangentbyte.com/learn/estimation.md): Before you draw boxes, you need a rough idea of how big the problem is. Is it 50 requests per second or 500,000? Gigabytes or petabytes? The answer decides whether one database… - [Consistent hashing](https://system.tangentbyte.com/learn/consistent-hashing.md): Once data or cache entries are spread across several machines, every request has to answer one question: which machine holds this key? The obvious answer, hashing the key and… - [Rate limiting](https://system.tangentbyte.com/learn/rate-limiting.md): A rate limiter caps how many requests a client can make in a period of time and turns away the rest. It protects shared capacity from one noisy client, blunts abuse like… - [Unique ID generation](https://system.tangentbyte.com/learn/unique-ids.md): Every row, message, order and event needs an identifier. On a single database you let it hand out auto-increment numbers and never think about it again. Once you shard, run… - [Message queues and event streams](https://system.tangentbyte.com/learn/event-streaming.md): The primer's Asynchronism chapter explains why queues exist: put slow work on a queue and let workers pick it up later. Interviewers then ask the next questions. What happens if a… - [Timeouts, retries and idempotency](https://system.tangentbyte.com/learn/reliability-patterns.md): Once a request crosses a network, three outcomes are possible: it succeeds, it fails, or you don't know. The third case is the hard one. The server may never have received the… - [Distributed transactions and sagas](https://system.tangentbyte.com/learn/distributed-transactions.md): Inside one relational database, a transaction makes several writes succeed or fail together. The primer's RDBMS section lists the ACID properties that make this work. Split the… - [Consensus, leader election and coordination](https://system.tangentbyte.com/learn/consensus.md): Many designs quietly assume that some decision is made exactly once: which database node is the primary, which worker owns a shard, who holds a lock, whether a config change… - [Real-time updates: polling, WebSockets and server-sent events](https://system.tangentbyte.com/learn/realtime.md): Plain HTTP is request/response: the client asks, the server answers, and the server has no way to speak first. Plenty of features need the server to speak first. Examples include… - [Monitoring, logging and tracing](https://system.tangentbyte.com/learn/observability.md): A system you can't see into is a system you can't run. When checkout gets slow at 2 a.m., someone needs to answer three questions fast: is it actually broken for users, where is… ## Beyond the primer: design questions - [Design a distributed key-value store](https://system.tangentbyte.com/learn/design-key-value-store.md): The primer describes a key-value store as a hash table: put a key, get it back. This question asks you to build one that spans dozens of machines, keeps working when some of them… - [Design a notification system](https://system.tangentbyte.com/learn/design-notification-system.md): Almost every product sends notifications: a one-time login code, "your order shipped", "your friend commented", "presale starts in an hour". Each one is a small message, but the… - [Design a chat system](https://system.tangentbyte.com/learn/design-chat-system.md): A chat system lets people exchange short messages in near real time, one to one or in groups, across several devices each. It looks simple until you list what users take for… - [Design search autocomplete (typeahead)](https://system.tangentbyte.com/learn/design-autocomplete.md): Autocomplete suggests whole queries while you type a prefix: type "how to bo" and you see "how to boil eggs", "how to boost wifi signal" and a few more. It saves keystrokes,… - [Design a video streaming platform](https://system.tangentbyte.com/learn/design-video-streaming.md): A video platform lets creators upload videos and lets viewers watch them on anything from a phone on a train to a living-room TV. The upload side is a batch pipeline that turns… - [Design a file sync service (like Dropbox or Google Drive)](https://system.tangentbyte.com/learn/design-file-sync.md): A file sync service keeps a folder identical across a user's laptop, desktop and phone, and across everyone it's shared with. Save a file on one machine and, a few seconds later,… ## Optional - [About the primer](https://system.tangentbyte.com/learn/about.md): The provided Anki flashcard decks use spaced repetition to help you retain key system design concepts.