The System Design Primer, made for quick reading.
A clean, fast-reading web edition of the System Design Primer by Donne Martin. Search a topic or filter by tag to begin.
56 topics
- 01 CONCEPTS Performance vs scalability
A service is scalable if it results in increased performance in a manner proportional to resources added. Generally, increasing performance means serving more…
- 02 CONCEPTS Latency vs throughput
Latency is the time to perform some action or to produce some result. Throughput is the number of such actions or results per unit of time. Generally, you…
- 03 CONCEPTS Consistency patterns
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…
- 04 CONCEPTS Availability patterns
There are two complementary patterns to support high availability: fail over and replication . Fail over Active passive With active passive fail over,…
- 05 CONCEPTS Availability vs consistency
CAP theorem In a distributed computer system, you can only support two of the following guarantees: Consistency Every read receives the most recent write or an…
- 06 CONCEPTS Domain name system
A Domain Name System (DNS) translates a domain name such as www.example.com to an IP address. DNS is hierarchical, with a few authoritative servers at the top…
- 07 CONCEPTS Content delivery network
A content delivery network (CDN) is a globally distributed network of proxy servers, serving content from locations closer to the user. Generally, static files…
- 08 CONCEPTS Load balancer
Load balancers distribute incoming client requests to computing resources such as application servers and databases. In each case, the load balancer returns…
- 09 CONCEPTS Reverse proxy (web server)
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…
- 10 CONCEPTS Application layer
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…
- 11 CONCEPTS Database
Relational database management system (RDBMS) A relational database like SQL is a collection of data items organized in tables. ACID is a set of properties of…
- 12 CONCEPTS Federation
Federation (or functional partitioning) splits up databases by function. For example, instead of a single, monolithic database, you could have three databases:…
- 13 CONCEPTS Sharding
Sharding distributes data across different databases such that each database can only manage a subset of the data. Taking a users database as an example, as…
- 14 CONCEPTS Denormalization
Denormalization attempts to improve read performance at the expense of some write performance. Redundant copies of the data are written in multiple tables to…
- 15 CONCEPTS SQL tuning
SQL tuning is a broad topic and many books have been written as reference. It's important to benchmark and profile to simulate and uncover bottlenecks.…
- 16 CONCEPTS NoSQL
NoSQL is a collection of data items represented in a key value store , document store , wide column store , or a graph database . Data is denormalized, and…
- 17 CONCEPTS Key-value store
Abstraction: hash table A key value store generally allows for O(1) reads and writes and is often backed by memory or SSD. Data stores can maintain keys in…
- 18 CONCEPTS Document store
Abstraction: key value store with documents stored as values A document store is centered around documents (XML, JSON, binary, etc), where a document stores…
- 19 CONCEPTS Wide column store
Abstraction: nested map A wide column store's basic unit of data is a column (name/value pair). A column can be grouped in column families (analogous to a SQL…
- 20 CONCEPTS Graph database
Abstraction: graph In a graph database, each node is a record and each arc is a relationship between two nodes. Graph databases are optimized to represent…
- 21 CONCEPTS SQL or NoSQL
Reasons for SQL : Structured data Strict schema Relational data Need for complex joins Transactions Clear patterns for scaling More established: developers,…
- 22 CONCEPTS Cache
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…
- 23 CONCEPTS Cache locations
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…
- 24 CONCEPTS Database caching, what to cache
Relational database management system (RDBMS) A relational database like SQL is a collection of data items organized in tables. ACID is a set of properties of…
- 25 CONCEPTS Cache-aside
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…
- 26 CONCEPTS Write-through
The application uses the cache as the main data store, reading and writing data to it, while the cache is responsible for reading and writing to the database:…
- 27 CONCEPTS Write-behind (write-back)
In write behind, the application does the following: Add/update entry in cache Asynchronously write entry to the data store, improving write performance…
- 28 CONCEPTS Refresh-ahead
You can configure the cache to automatically refresh any recently accessed cache entry prior to its expiration. Refresh ahead can result in reduced latency vs…
- 29 CONCEPTS Asynchronism
Asynchronous workflows help reduce request times for expensive operations that would otherwise be performed in line. They can also help by doing time consuming…
- 30 CONCEPTS Communication
Hypertext transfer protocol (HTTP) HTTP is a method for encoding and transporting data between a client and a server. It is a request/response protocol:…
- 31 CONCEPTS Hypertext transfer protocol (HTTP)
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…
- 32 CONCEPTS Transmission control protocol (TCP)
TCP is a connection oriented protocol over an IP network. Connection is established and terminated using a handshake. All packets sent are guaranteed to reach…
- 33 CONCEPTS User datagram protocol (UDP)
UDP is connectionless. Datagrams (analogous to packets) are guaranteed only at the datagram level. Datagrams might reach their destination out of order or not…
- 34 CONCEPTS Remote procedure call (RPC)
In an RPC, a client causes a procedure to execute on a different address space, usually a remote server. The procedure is coded as if it were a local procedure…
- 35 CONCEPTS Representational state transfer (REST)
REST is an architectural style enforcing a client/server model where the client acts on a set of resources managed by the server. The server provides a…
- 36 CONCEPTS Security
This section could use some updates. Consider contributing! Security is a broad topic. Unless you have considerable experience, a security background, or are…
- 37 CONCEPTS Powers of two table
Source(s) and further reading Powers of two
- 38 CONCEPTS Latency numbers every programmer should know
Handy metrics based on numbers above: Read sequentially from HDD at 30 MB/s Read sequentially from 1 Gbps Ethernet at 100 MB/s Read sequentially from SSD at 1…
- 39 CONCEPTS MD5
Widely used hashing function that produces a 128 bit hash value Uniformly distributed
- 40 CONCEPTS Base 62
Encodes to which works well for urls, eliminating the need for escaping special characters Only one hash result for the original input and and the operation is…
- 41 CONCEPTS What is HATEOAS?
What is HATEOAS and why is it important for my REST API? HATEOAS stands for Hypertext As The Engine Of Application State . It means that hypertext should be…
- 42 CONCEPTS RPC and REST calls comparison
Operation RPC REST Signup POST /signup POST /persons Resign POST /resign \{ "personid": "1234" \} DELETE /persons/1234 Read a person GET…
- 43 EXERCISE Design Mint.com
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 44 EXERCISE Design Pastebin.com (or Bit.ly)
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 45 EXERCISE Design Amazon's sales rank by category feature
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 46 EXERCISE Design a web crawler
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 47 EXERCISE Design the data structures for a social network
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 48 EXERCISE Design the Twitter timeline and search
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 49 EXERCISE Design a key-value cache to save the results of the most recent web server queries
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 50 EXERCISE Design a system that scales to millions of users on AWS
Note: This document links directly to relevant areas found in the system design topics to avoid duplication. Refer to the linked content for general talking…
- 51 OO DESIGN Design a deck of cards
Constraints and assumptions Is this a generic deck of cards for games like poker and black jack? Yes, design a generic deck then extend it to black jack Can we…
- 52 OO DESIGN Design a call center
Constraints and assumptions What levels of employees are in the call center? Operator, supervisor, director Can we assume operators always get the initial…
- 53 OO DESIGN Design a hash map
Constraints and assumptions For simplicity, are the keys integers only? Yes For collision resolution, can we use chaining? Yes Do we have to worry about load…
- 54 OO DESIGN Design an LRU cache
Constraints and assumptions What are we caching? We are cahing the results of web queries Can we assume inputs are valid or do we have to validate them? Assume…
- 55 OO DESIGN Design an online chat
Constraints and assumptions Assume we'll focus on the following workflows: Text conversations only Users Add a user Remove a user Update a user Add to a user's…
- 56 OO DESIGN Design a parking lot
Constraints and assumptions What types of vehicles should we support? Motorcycle, Car, Bus Does each vehicle type take up a different amount of parking spots?…