# The System Design Primer


## Motivation > Learn how to design large scale systems from the open source community. > > Understand real-world architectures. > > Prep for the system design interview. ### Learn how to design large scale systems Learning how to design scalable systems will make you a better engineer. System design is a broad topic. There is a **vast amount of resources scattered throughout the web** on system design principles. This repo is an **organized collection** of resources to help you learn how to build systems at scale. Topics for learning system design: * [System design topic summaries](#index-of-system-design-topics) * [Real world architectures](#real-world-architectures) * [Engineering blogs](#company-engineering-blogs) #### Learn from the open source community This is an **early draft** of a **continually updated, open source** project. [Contributions](#contributin) are welcome! ### Prep for the system design interview In addition to coding interviews, system design is a **required component** of the **technical interview process** at many tech companies. **Practice common system design interview questions** and **compare** your results with sample **discussions, code, and diagrams**. Additional topics for interview prep: * [Study guide](#study-guide) * [How to approach a system design interview question](#how-to-approach-a-system-design-interview-question) * [System design interview questions, **with solutions**](#system-design-interview-questions-with-solutions) * [Object-oriented design interview questions, **with solutions**](#object-oriented-design-interview-questions-with-solutions) * [Additional system design interview questions](#additional-system-design-interview-questions) #### For interviews, do I need to know everything here? **No, you don't need to know everything here to prepare for the interview**. What you are asked in an interview depends on variables such as: * How much experience you have * What your technical background is * What positions you are interviewing for * Which companies you are interviewing with * Luck More experienced candidates are generally expected to know more about system design. Architects or team leads might be expected to know more than individual contributors. Top tech companies are likely to have one or more design interview rounds. #### Any resources to prep for coding interviews? Check out the sister repo [**interactive-coding-challenges**](https://github.com/donnemartin/interactive-coding-challenges) for coding interview resources. ## Contributing > Learn from the community. Feel free to submit pull requests to help: * Fix errors * Improve sections * Add new sections Content that needs some polishing is placed [under development](#under-development). Review the [Contributing Guidelines](https://github.com/donnemartin/awesome-aws/blob/master/CONTRIBUTING.md). ## Index of system design topics > Summaries of various system design topics, including pros and cons. **Everything is a trade-off**. > > Each section contains links to more in-depth resources. ![Imgur](http://i.imgur.com/jj3A5N8.png) * [System design topics: start here](#system-design-topics-start-here) * [Step 1: Review the scalability video lecture](#step-1-review-the-scalability-video-lecture) * [Step 2: Review the scalability article](#step-2-review-the-scalability-article) * [Next steps](#next-steps) * [Performance vs scalability](#performance-vs-scalability) * [Latency vs throughput](#latency-vs-throughput) * [Availability vs consistency](#availability-vs-consistency) * [CAP theorem](#cap-theorem) * [CP - consistency and partition tolerance](#cp-consistency-and-partition-tolerance) * [AP - availability and partition tolerance](#ap-availability-and-partition-tolerance) * [Consistency patterns](#consistency-patterns) * [Weak consistency](#weak-consistency) * [Eventual consistency](#eventual-consistency) * [Strong consistency](#strong-consistency) * [Availability patterns](#availability-patterns) * [Fail-over](#fail-over) * [Replication](#replication) * [Domain name system](#domain-name-system) * [Content delivery network](#content-delivery-network) * [Push CDNs](#push-cdns) * [Pull CDNs](#pull-cdns) * [Load balancer](#load-balancer) * [Active-passive](#active-passive) * [Active-active](#active-active) * [Layer 4 load balancing](#layer-4-load-balancing) * [Layer 7 load balancing](#layer-7-load-balancing) * [Horizontal scaling](#horizontal-scaling) * [Reverse proxy (web server)](#reverse-proxy-web-server) * [Load balancer vs reverse proxy](#load-balancer-vs-reverse-proxy) * [Application layer](#application-layer) * [Microservices](#microservices) * [Service discovery](#service-discovery) * [Database](#database) * [SQL](#sql) * [Relational database management system (RDBMS)](relational-database-management-system-rdbms) * [Scaling SQL](#scaling-sql) * [Master-slave replication](#master-slave-replication) * [Federation](#federation) * [Sharding](#sharding) * [Denormalization](#denormalization) * [SQL tuning](#sql-tuning) * [NoSQL](#nosql) * [Key-value store](#key-value-store) * [Document store](#document-store) * [Wide column store](#wide-column-store) * [Graph Database](#graph-database) * [SQL or NoSQL](#sql-or-nosql) * [Cache](#cache) * [Client caching](#client-caching) * [CDN caching](#cdn-caching) * [Web server caching](#web-server-caching) * [Database caching](#database-caching) * [Application caching](#application-caching) * [Caching at the database query level](#caching-at-the-database-query-level) * [Caching at the object level](#caching-at-the-object-level) * [When to update the cache](#when-to-update-the-cache) * [Cache-aside](#cache-aside) * [Write-through](#write-through) * [Write-behind (write-back)](#write-behind-write-back) * [Refresh-ahead](#refresh-ahead) * [Asynchronism](#asynchronism) * [Message queues](#message-queues) * [Task queues](#task-queues) * [Back pressure](#back-pressure) * [Communication](#communication) * [Transmission control protocol (TCP)](#transmission-control-protocol-tcp) * [User datagram protocol (UDP)](#user-datagram-protocol-udp) * [Remote procedure call (RPC)](#remote-procedure-call-rpc) * [Representational state transfer (REST)](#representational-state-transfer-rest) * [Security](#security) * [Appendix](#appendix) * [Powers of two table](#powers-of-two-table) * [Latency numbers every programmer should know](#latency-numbers-every-programmer-should-know) * [Under development](#under-development) * [Distributed computing](#distributed-computing) * [Consistent hashing](#consistent-hashing) * [Scatter gather](#scatter-gather) * [Contribute](#contributing) * [Credits](#credits) * [Contact info](#contact-info) * [License](#license)