mirror of
https://github.com/donnemartin/system-design-primer.git
synced 2025-12-15 17:38:56 +03:00
Update the solutions notebooks and README files to reflect new GitHub repository links for source, ensuring consistency across the documentation.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 在 AWS 上设计支持百万级到千万级用户的系统
|
||||
|
||||
**注释:为了避免重复,这篇文章的链接直接关联到 [系统设计主题](https://github.com/donnemartin/system-design-primer#index-of-system-design-topics) 的相关章节。为一讨论要点、折中方案和可选方案做参考。**
|
||||
**注释:为了避免重复,这篇文章的链接直接关联到 [系统设计主题](https://github.com/ido777/system-design-primer-update#index-of-system-design-topics) 的相关章节。为一讨论要点、折中方案和可选方案做参考。**
|
||||
|
||||
## 第 1 步:用例和约束概要
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
* **Web 服务器** 在 EC2 上
|
||||
* 存储用户数据
|
||||
* [**MySQL 数据库**](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms)
|
||||
* [**MySQL 数据库**](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms)
|
||||
|
||||
运用 **纵向扩展**:
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* **纵向扩展** 的可选方案是 [**横向扩展**](https://github.com/donnemartin/system-design-primer#horizontal-scaling)
|
||||
* **纵向扩展** 的可选方案是 [**横向扩展**](https://github.com/ido777/system-design-primer-update#horizontal-scaling)
|
||||
|
||||
#### 自 SQL 开始,但认真考虑 NoSQL
|
||||
|
||||
@@ -104,8 +104,8 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* 查阅 [关系型数据库管理系统 (RDBMS)](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms) 章节
|
||||
* 讨论使用 [SQL 或 NoSQL](https://github.com/donnemartin/system-design-primer#sql-or-nosql) 的原因
|
||||
* 查阅 [关系型数据库管理系统 (RDBMS)](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms) 章节
|
||||
* 讨论使用 [SQL 或 NoSQL](https://github.com/ido777/system-design-primer-update#sql-or-nosql) 的原因
|
||||
|
||||
#### 分配公共静态 IP
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* 查阅 [域名系统](https://github.com/donnemartin/system-design-primer#domain-name-system) 章节
|
||||
* 查阅 [域名系统](https://github.com/ido777/system-design-primer-update#domain-name-system) 章节
|
||||
|
||||
#### 安全的 Web 服务器
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* 查阅 [安全](https://github.com/donnemartin/system-design-primer#security) 章节
|
||||
* 查阅 [安全](https://github.com/ido777/system-design-primer-update#security) 章节
|
||||
|
||||
## 第 4 步:扩展设计
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* 查阅 [安全](https://github.com/donnemartin/system-design-primer#security) 章节
|
||||
* 查阅 [安全](https://github.com/ido777/system-design-primer-update#security) 章节
|
||||
|
||||
### 用户+++
|
||||
|
||||
@@ -201,18 +201,18 @@
|
||||
|
||||
* 下面的目标试图用 **Web服务器** 解决扩展问题
|
||||
* 基于 **基准/负载测试** 和 **分析**,你可能只需要实现其中的一两个技术
|
||||
* 使用 [**横向扩展**](https://github.com/donnemartin/system-design-primer#horizontal-scaling) 来处理增加的负载和单点故障
|
||||
* 添加 [**负载均衡器**](https://github.com/donnemartin/system-design-primer#load-balancer) 例如 Amazon 的 ELB 或 HAProxy
|
||||
* 使用 [**横向扩展**](https://github.com/ido777/system-design-primer-update#horizontal-scaling) 来处理增加的负载和单点故障
|
||||
* 添加 [**负载均衡器**](https://github.com/ido777/system-design-primer-update#load-balancer) 例如 Amazon 的 ELB 或 HAProxy
|
||||
* ELB 是高可用的
|
||||
* 如果你正在配置自己的 **负载均衡器**, 在多个可用区域中设置多台服务器用于 [双活](https://github.com/donnemartin/system-design-primer#active-active) 或 [主被](https://github.com/donnemartin/system-design-primer#active-passive) 将提高可用性
|
||||
* 如果你正在配置自己的 **负载均衡器**, 在多个可用区域中设置多台服务器用于 [双活](https://github.com/ido777/system-design-primer-update#active-active) 或 [主被](https://github.com/ido777/system-design-primer-update#active-passive) 将提高可用性
|
||||
* 终止在 **负载平衡器** 上的SSL,以减少后端服务器上的计算负载,并简化证书管理
|
||||
* 在多个可用区域中使用多台 **Web服务器**
|
||||
* 在多个可用区域的 [**主-从 故障转移**](https://github.com/donnemartin/system-design-primer#master-slave-replication) 模式中使用多个 **MySQL** 实例来改进冗余
|
||||
* 分离 **Web 服务器** 和 [**应用服务器**](https://github.com/donnemartin/system-design-primer#application-layer)
|
||||
* 在多个可用区域的 [**主-从 故障转移**](https://github.com/ido777/system-design-primer-update#master-slave-replication) 模式中使用多个 **MySQL** 实例来改进冗余
|
||||
* 分离 **Web 服务器** 和 [**应用服务器**](https://github.com/ido777/system-design-primer-update#application-layer)
|
||||
* 独立扩展和配置每一层
|
||||
* **Web 服务器** 可以作为 [**反向代理**](https://github.com/donnemartin/system-design-primer#reverse-proxy-web-server)
|
||||
* **Web 服务器** 可以作为 [**反向代理**](https://github.com/ido777/system-design-primer-update#reverse-proxy-web-server)
|
||||
* 例如, 你可以添加 **应用服务器** 处理 **读 API** 而另外一些处理 **写 API**
|
||||
* 将静态(和一些动态)内容转移到 [**内容分发网络 (CDN)**](https://github.com/donnemartin/system-design-primer#content-delivery-network) 例如 CloudFront 以减少负载和延迟
|
||||
* 将静态(和一些动态)内容转移到 [**内容分发网络 (CDN)**](https://github.com/ido777/system-design-primer-update#content-delivery-network) 例如 CloudFront 以减少负载和延迟
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
@@ -232,13 +232,13 @@
|
||||
|
||||
* 下面的目标试图解决 **MySQL数据库** 的伸缩性问题
|
||||
* * 基于 **基准/负载测试** 和 **分析**,你可能只需要实现其中的一两个技术
|
||||
* 将下列数据移动到一个 [**内存缓存**](https://github.com/donnemartin/system-design-primer#cache),例如弹性缓存,以减少负载和延迟:
|
||||
* 将下列数据移动到一个 [**内存缓存**](https://github.com/ido777/system-design-primer-update#cache),例如弹性缓存,以减少负载和延迟:
|
||||
* **MySQL** 中频繁访问的内容
|
||||
* 首先, 尝试配置 **MySQL 数据库** 缓存以查看是否足以在实现 **内存缓存** 之前缓解瓶颈
|
||||
* 来自 **Web 服务器** 的会话数据
|
||||
* **Web 服务器** 变成无状态的, 允许 **自动伸缩**
|
||||
* 从内存中读取 1 MB 内存需要大约 250 微秒,而从SSD中读取时间要长 4 倍,从磁盘读取的时间要长 80 倍。<sup><a href=https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know>1</a></sup>
|
||||
* 添加 [**MySQL 读取副本**](https://github.com/donnemartin/system-design-primer#master-slave-replication) 来减少写主线程的负载
|
||||
* 从内存中读取 1 MB 内存需要大约 250 微秒,而从SSD中读取时间要长 4 倍,从磁盘读取的时间要长 80 倍。<sup><a href=https://github.com/ido777/system-design-primer-update#latency-numbers-every-programmer-should-know>1</a></sup>
|
||||
* 添加 [**MySQL 读取副本**](https://github.com/ido777/system-design-primer-update#master-slave-replication) 来减少写主线程的负载
|
||||
* 添加更多 **Web 服务器** and **应用服务器** 来提高响应
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
**折中方案, 可选方案, 和其他细节:**
|
||||
|
||||
* 查阅 [关系型数据库管理系统 (RDBMS)](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms) 章节
|
||||
* 查阅 [关系型数据库管理系统 (RDBMS)](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms) 章节
|
||||
|
||||
### 用户++++
|
||||
|
||||
@@ -317,14 +317,14 @@
|
||||
|
||||
SQL 扩展模型包括:
|
||||
|
||||
* [集合](https://github.com/donnemartin/system-design-primer#federation)
|
||||
* [分片](https://github.com/donnemartin/system-design-primer#sharding)
|
||||
* [反范式](https://github.com/donnemartin/system-design-primer#denormalization)
|
||||
* [SQL 调优](https://github.com/donnemartin/system-design-primer#sql-tuning)
|
||||
* [集合](https://github.com/ido777/system-design-primer-update#federation)
|
||||
* [分片](https://github.com/ido777/system-design-primer-update#sharding)
|
||||
* [反范式](https://github.com/ido777/system-design-primer-update#denormalization)
|
||||
* [SQL 调优](https://github.com/ido777/system-design-primer-update#sql-tuning)
|
||||
|
||||
为了进一步处理高读和写请求,我们还应该考虑将适当的数据移动到一个 [**NoSQL数据库**](https://github.com/donnemartin/system-design-primer#nosql) ,例如 DynamoDB。
|
||||
为了进一步处理高读和写请求,我们还应该考虑将适当的数据移动到一个 [**NoSQL数据库**](https://github.com/ido777/system-design-primer-update#nosql) ,例如 DynamoDB。
|
||||
|
||||
我们可以进一步分离我们的 [**应用服务器**](https://github.com/donnemartin/system-design-primer#application-layer) 以允许独立扩展。不需要实时完成的批处理任务和计算可以通过 Queues 和 Workers 异步完成:
|
||||
我们可以进一步分离我们的 [**应用服务器**](https://github.com/ido777/system-design-primer-update#application-layer) 以允许独立扩展。不需要实时完成的批处理任务和计算可以通过 Queues 和 Workers 异步完成:
|
||||
|
||||
* 以照片服务为例,照片上传和缩略图的创建可以分开进行
|
||||
* **客户端** 上传图片
|
||||
@@ -344,58 +344,58 @@ SQL 扩展模型包括:
|
||||
|
||||
### SQL 扩展模式
|
||||
|
||||
* [读取副本](https://github.com/donnemartin/system-design-primer#master-slave-replication)
|
||||
* [集合](https://github.com/donnemartin/system-design-primer#federation)
|
||||
* [分区](https://github.com/donnemartin/system-design-primer#sharding)
|
||||
* [反规范化](https://github.com/donnemartin/system-design-primer#denormalization)
|
||||
* [SQL 调优](https://github.com/donnemartin/system-design-primer#sql-tuning)
|
||||
* [读取副本](https://github.com/ido777/system-design-primer-update#master-slave-replication)
|
||||
* [集合](https://github.com/ido777/system-design-primer-update#federation)
|
||||
* [分区](https://github.com/ido777/system-design-primer-update#sharding)
|
||||
* [反规范化](https://github.com/ido777/system-design-primer-update#denormalization)
|
||||
* [SQL 调优](https://github.com/ido777/system-design-primer-update#sql-tuning)
|
||||
|
||||
#### NoSQL
|
||||
|
||||
* [键值存储](https://github.com/donnemartin/system-design-primer#key-value-store)
|
||||
* [文档存储](https://github.com/donnemartin/system-design-primer#document-store)
|
||||
* [宽表存储](https://github.com/donnemartin/system-design-primer#wide-column-store)
|
||||
* [图数据库](https://github.com/donnemartin/system-design-primer#graph-database)
|
||||
* [SQL vs NoSQL](https://github.com/donnemartin/system-design-primer#sql-or-nosql)
|
||||
* [键值存储](https://github.com/ido777/system-design-primer-update#key-value-store)
|
||||
* [文档存储](https://github.com/ido777/system-design-primer-update#document-store)
|
||||
* [宽表存储](https://github.com/ido777/system-design-primer-update#wide-column-store)
|
||||
* [图数据库](https://github.com/ido777/system-design-primer-update#graph-database)
|
||||
* [SQL vs NoSQL](https://github.com/ido777/system-design-primer-update#sql-or-nosql)
|
||||
|
||||
### 缓存
|
||||
|
||||
* 缓存到哪里
|
||||
* [客户端缓存](https://github.com/donnemartin/system-design-primer#client-caching)
|
||||
* [CDN 缓存](https://github.com/donnemartin/system-design-primer#cdn-caching)
|
||||
* [Web 服务缓存](https://github.com/donnemartin/system-design-primer#web-server-caching)
|
||||
* [数据库缓存](https://github.com/donnemartin/system-design-primer#database-caching)
|
||||
* [应用缓存](https://github.com/donnemartin/system-design-primer#application-caching)
|
||||
* [客户端缓存](https://github.com/ido777/system-design-primer-update#client-caching)
|
||||
* [CDN 缓存](https://github.com/ido777/system-design-primer-update#cdn-caching)
|
||||
* [Web 服务缓存](https://github.com/ido777/system-design-primer-update#web-server-caching)
|
||||
* [数据库缓存](https://github.com/ido777/system-design-primer-update#database-caching)
|
||||
* [应用缓存](https://github.com/ido777/system-design-primer-update#application-caching)
|
||||
* 缓存什么
|
||||
* [数据库请求层缓存](https://github.com/donnemartin/system-design-primer#caching-at-the-database-query-level)
|
||||
* [对象层缓存](https://github.com/donnemartin/system-design-primer#caching-at-the-object-level)
|
||||
* [数据库请求层缓存](https://github.com/ido777/system-design-primer-update#caching-at-the-database-query-level)
|
||||
* [对象层缓存](https://github.com/ido777/system-design-primer-update#caching-at-the-object-level)
|
||||
* 何时更新缓存
|
||||
* [预留缓存](https://github.com/donnemartin/system-design-primer#cache-aside)
|
||||
* [完全写入](https://github.com/donnemartin/system-design-primer#write-through)
|
||||
* [延迟写 (写回)](https://github.com/donnemartin/system-design-primer#write-behind-write-back)
|
||||
* [事先更新](https://github.com/donnemartin/system-design-primer#refresh-ahead)
|
||||
* [预留缓存](https://github.com/ido777/system-design-primer-update#cache-aside)
|
||||
* [完全写入](https://github.com/ido777/system-design-primer-update#write-through)
|
||||
* [延迟写 (写回)](https://github.com/ido777/system-design-primer-update#write-behind-write-back)
|
||||
* [事先更新](https://github.com/ido777/system-design-primer-update#refresh-ahead)
|
||||
|
||||
### 异步性和微服务
|
||||
|
||||
* [消息队列](https://github.com/donnemartin/system-design-primer#message-queues)
|
||||
* [任务队列](https://github.com/donnemartin/system-design-primer#task-queues)
|
||||
* [回退压力](https://github.com/donnemartin/system-design-primer#back-pressure)
|
||||
* [微服务](https://github.com/donnemartin/system-design-primer#microservices)
|
||||
* [消息队列](https://github.com/ido777/system-design-primer-update#message-queues)
|
||||
* [任务队列](https://github.com/ido777/system-design-primer-update#task-queues)
|
||||
* [回退压力](https://github.com/ido777/system-design-primer-update#back-pressure)
|
||||
* [微服务](https://github.com/ido777/system-design-primer-update#microservices)
|
||||
|
||||
### 沟通
|
||||
|
||||
* 关于折中方案的讨论:
|
||||
* 客户端的外部通讯 - [遵循 REST 的 HTTP APIs](https://github.com/donnemartin/system-design-primer#representational-state-transfer-rest)
|
||||
* 内部通讯 - [RPC](https://github.com/donnemartin/system-design-primer#remote-procedure-call-rpc)
|
||||
* [服务探索](https://github.com/donnemartin/system-design-primer#service-discovery)
|
||||
* 客户端的外部通讯 - [遵循 REST 的 HTTP APIs](https://github.com/ido777/system-design-primer-update#representational-state-transfer-rest)
|
||||
* 内部通讯 - [RPC](https://github.com/ido777/system-design-primer-update#remote-procedure-call-rpc)
|
||||
* [服务探索](https://github.com/ido777/system-design-primer-update#service-discovery)
|
||||
|
||||
### 安全性
|
||||
|
||||
参考 [安全章节](https://github.com/donnemartin/system-design-primer#security)
|
||||
参考 [安全章节](https://github.com/ido777/system-design-primer-update#security)
|
||||
|
||||
### 延迟数字指标
|
||||
|
||||
查阅 [每个程序员必懂的延迟数字](https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know)
|
||||
查阅 [每个程序员必懂的延迟数字](https://github.com/ido777/system-design-primer-update#latency-numbers-every-programmer-should-know)
|
||||
|
||||
### 正在进行
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 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](https://github.com/donnemartin/system-design-primer#index-of-system-design-topics) to avoid duplication. Refer to the linked content for general talking points, tradeoffs, and alternatives.*
|
||||
*Note: This document links directly to relevant areas found in the [system design topics](https://github.com/ido777/system-design-primer-update#index-of-system-design-topics) to avoid duplication. Refer to the linked content for general talking points, tradeoffs, and alternatives.*
|
||||
|
||||
## Step 1: Outline use cases and constraints
|
||||
|
||||
@@ -83,7 +83,7 @@ Handy conversion guide:
|
||||
|
||||
* **Web server** on EC2
|
||||
* Storage for user data
|
||||
* [**MySQL Database**](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms)
|
||||
* [**MySQL Database**](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms)
|
||||
|
||||
Use **Vertical Scaling**:
|
||||
|
||||
@@ -96,7 +96,7 @@ Use **Vertical Scaling**:
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* The alternative to **Vertical Scaling** is [**Horizontal scaling**](https://github.com/donnemartin/system-design-primer#horizontal-scaling)
|
||||
* The alternative to **Vertical Scaling** is [**Horizontal scaling**](https://github.com/ido777/system-design-primer-update#horizontal-scaling)
|
||||
|
||||
#### Start with SQL, consider NoSQL
|
||||
|
||||
@@ -104,8 +104,8 @@ The constraints assume there is a need for relational data. We can start off us
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* See the [Relational database management system (RDBMS)](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms) section
|
||||
* Discuss reasons to use [SQL or NoSQL](https://github.com/donnemartin/system-design-primer#sql-or-nosql)
|
||||
* See the [Relational database management system (RDBMS)](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms) section
|
||||
* Discuss reasons to use [SQL or NoSQL](https://github.com/ido777/system-design-primer-update#sql-or-nosql)
|
||||
|
||||
#### Assign a public static IP
|
||||
|
||||
@@ -118,7 +118,7 @@ Add a **DNS** such as Route 53 to map the domain to the instance's public IP.
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* See the [Domain name system](https://github.com/donnemartin/system-design-primer#domain-name-system) section
|
||||
* See the [Domain name system](https://github.com/ido777/system-design-primer-update#domain-name-system) section
|
||||
|
||||
#### Secure the web server
|
||||
|
||||
@@ -131,7 +131,7 @@ Add a **DNS** such as Route 53 to map the domain to the instance's public IP.
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* See the [Security](https://github.com/donnemartin/system-design-primer#security) section
|
||||
* See the [Security](https://github.com/ido777/system-design-primer-update#security) section
|
||||
|
||||
## Step 4: Scale the design
|
||||
|
||||
@@ -187,7 +187,7 @@ We've been able to address these issues with **Vertical Scaling** so far. Unfor
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* See the [Security](https://github.com/donnemartin/system-design-primer#security) section
|
||||
* See the [Security](https://github.com/ido777/system-design-primer-update#security) section
|
||||
|
||||
### Users++
|
||||
|
||||
@@ -201,18 +201,18 @@ Our **Benchmarks/Load Tests** and **Profiling** show that our single **Web Serve
|
||||
|
||||
* The following goals attempt to address the scaling issues with the **Web Server**
|
||||
* Based on the **Benchmarks/Load Tests** and **Profiling**, you might only need to implement one or two of these techniques
|
||||
* Use [**Horizontal Scaling**](https://github.com/donnemartin/system-design-primer#horizontal-scaling) to handle increasing loads and to address single points of failure
|
||||
* Add a [**Load Balancer**](https://github.com/donnemartin/system-design-primer#load-balancer) such as Amazon's ELB or HAProxy
|
||||
* Use [**Horizontal Scaling**](https://github.com/ido777/system-design-primer-update#horizontal-scaling) to handle increasing loads and to address single points of failure
|
||||
* Add a [**Load Balancer**](https://github.com/ido777/system-design-primer-update#load-balancer) such as Amazon's ELB or HAProxy
|
||||
* ELB is highly available
|
||||
* If you are configuring your own **Load Balancer**, setting up multiple servers in [active-active](https://github.com/donnemartin/system-design-primer#active-active) or [active-passive](https://github.com/donnemartin/system-design-primer#active-passive) in multiple availability zones will improve availability
|
||||
* If you are configuring your own **Load Balancer**, setting up multiple servers in [active-active](https://github.com/ido777/system-design-primer-update#active-active) or [active-passive](https://github.com/ido777/system-design-primer-update#active-passive) in multiple availability zones will improve availability
|
||||
* Terminate SSL on the **Load Balancer** to reduce computational load on backend servers and to simplify certificate administration
|
||||
* Use multiple **Web Servers** spread out over multiple availability zones
|
||||
* Use multiple **MySQL** instances in [**Master-Slave Failover**](https://github.com/donnemartin/system-design-primer#master-slave-replication) mode across multiple availability zones to improve redundancy
|
||||
* Separate out the **Web Servers** from the [**Application Servers**](https://github.com/donnemartin/system-design-primer#application-layer)
|
||||
* Use multiple **MySQL** instances in [**Master-Slave Failover**](https://github.com/ido777/system-design-primer-update#master-slave-replication) mode across multiple availability zones to improve redundancy
|
||||
* Separate out the **Web Servers** from the [**Application Servers**](https://github.com/ido777/system-design-primer-update#application-layer)
|
||||
* Scale and configure both layers independently
|
||||
* **Web Servers** can run as a [**Reverse Proxy**](https://github.com/donnemartin/system-design-primer#reverse-proxy-web-server)
|
||||
* **Web Servers** can run as a [**Reverse Proxy**](https://github.com/ido777/system-design-primer-update#reverse-proxy-web-server)
|
||||
* For example, you can add **Application Servers** handling **Read APIs** while others handle **Write APIs**
|
||||
* Move static (and some dynamic) content to a [**Content Delivery Network (CDN)**](https://github.com/donnemartin/system-design-primer#content-delivery-network) such as CloudFront to reduce load and latency
|
||||
* Move static (and some dynamic) content to a [**Content Delivery Network (CDN)**](https://github.com/ido777/system-design-primer-update#content-delivery-network) such as CloudFront to reduce load and latency
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
@@ -232,13 +232,13 @@ Our **Benchmarks/Load Tests** and **Profiling** show that we are read-heavy (100
|
||||
|
||||
* The following goals attempt to address the scaling issues with the **MySQL Database**
|
||||
* Based on the **Benchmarks/Load Tests** and **Profiling**, you might only need to implement one or two of these techniques
|
||||
* Move the following data to a [**Memory Cache**](https://github.com/donnemartin/system-design-primer#cache) such as Elasticache to reduce load and latency:
|
||||
* Move the following data to a [**Memory Cache**](https://github.com/ido777/system-design-primer-update#cache) such as Elasticache to reduce load and latency:
|
||||
* Frequently accessed content from **MySQL**
|
||||
* First, try to configure the **MySQL Database** cache to see if that is sufficient to relieve the bottleneck before implementing a **Memory Cache**
|
||||
* Session data from the **Web Servers**
|
||||
* The **Web Servers** become stateless, allowing for **Autoscaling**
|
||||
* Reading 1 MB sequentially from memory takes about 250 microseconds, while reading from SSD takes 4x and from disk takes 80x longer.<sup><a href=https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know>1</a></sup>
|
||||
* Add [**MySQL Read Replicas**](https://github.com/donnemartin/system-design-primer#master-slave-replication) to reduce load on the write master
|
||||
* Reading 1 MB sequentially from memory takes about 250 microseconds, while reading from SSD takes 4x and from disk takes 80x longer.<sup><a href=https://github.com/ido777/system-design-primer-update#latency-numbers-every-programmer-should-know>1</a></sup>
|
||||
* Add [**MySQL Read Replicas**](https://github.com/ido777/system-design-primer-update#master-slave-replication) to reduce load on the write master
|
||||
* Add more **Web Servers** and **Application Servers** to improve responsiveness
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
@@ -254,7 +254,7 @@ Our **Benchmarks/Load Tests** and **Profiling** show that we are read-heavy (100
|
||||
|
||||
*Trade-offs, alternatives, and additional details:*
|
||||
|
||||
* See the [Relational database management system (RDBMS)](https://github.com/donnemartin/system-design-primer#relational-database-management-system-rdbms) section
|
||||
* See the [Relational database management system (RDBMS)](https://github.com/ido777/system-design-primer-update#relational-database-management-system-rdbms) section
|
||||
|
||||
### Users++++
|
||||
|
||||
@@ -317,14 +317,14 @@ We'll continue to address scaling issues due to the problem's constraints:
|
||||
|
||||
SQL scaling patterns include:
|
||||
|
||||
* [Federation](https://github.com/donnemartin/system-design-primer#federation)
|
||||
* [Sharding](https://github.com/donnemartin/system-design-primer#sharding)
|
||||
* [Denormalization](https://github.com/donnemartin/system-design-primer#denormalization)
|
||||
* [SQL Tuning](https://github.com/donnemartin/system-design-primer#sql-tuning)
|
||||
* [Federation](https://github.com/ido777/system-design-primer-update#federation)
|
||||
* [Sharding](https://github.com/ido777/system-design-primer-update#sharding)
|
||||
* [Denormalization](https://github.com/ido777/system-design-primer-update#denormalization)
|
||||
* [SQL Tuning](https://github.com/ido777/system-design-primer-update#sql-tuning)
|
||||
|
||||
To further address the high read and write requests, we should also consider moving appropriate data to a [**NoSQL Database**](https://github.com/donnemartin/system-design-primer#nosql) such as DynamoDB.
|
||||
To further address the high read and write requests, we should also consider moving appropriate data to a [**NoSQL Database**](https://github.com/ido777/system-design-primer-update#nosql) such as DynamoDB.
|
||||
|
||||
We can further separate out our [**Application Servers**](https://github.com/donnemartin/system-design-primer#application-layer) to allow for independent scaling. Batch processes or computations that do not need to be done in real-time can be done [**Asynchronously**](https://github.com/donnemartin/system-design-primer#asynchronism) with **Queues** and **Workers**:
|
||||
We can further separate out our [**Application Servers**](https://github.com/ido777/system-design-primer-update#application-layer) to allow for independent scaling. Batch processes or computations that do not need to be done in real-time can be done [**Asynchronously**](https://github.com/ido777/system-design-primer-update#asynchronism) with **Queues** and **Workers**:
|
||||
|
||||
* For example, in a photo service, the photo upload and the thumbnail creation can be separated:
|
||||
* **Client** uploads photo
|
||||
@@ -344,58 +344,58 @@ We can further separate out our [**Application Servers**](https://github.com/don
|
||||
|
||||
### SQL scaling patterns
|
||||
|
||||
* [Read replicas](https://github.com/donnemartin/system-design-primer#master-slave-replication)
|
||||
* [Federation](https://github.com/donnemartin/system-design-primer#federation)
|
||||
* [Sharding](https://github.com/donnemartin/system-design-primer#sharding)
|
||||
* [Denormalization](https://github.com/donnemartin/system-design-primer#denormalization)
|
||||
* [SQL Tuning](https://github.com/donnemartin/system-design-primer#sql-tuning)
|
||||
* [Read replicas](https://github.com/ido777/system-design-primer-update#master-slave-replication)
|
||||
* [Federation](https://github.com/ido777/system-design-primer-update#federation)
|
||||
* [Sharding](https://github.com/ido777/system-design-primer-update#sharding)
|
||||
* [Denormalization](https://github.com/ido777/system-design-primer-update#denormalization)
|
||||
* [SQL Tuning](https://github.com/ido777/system-design-primer-update#sql-tuning)
|
||||
|
||||
#### NoSQL
|
||||
|
||||
* [Key-value store](https://github.com/donnemartin/system-design-primer#key-value-store)
|
||||
* [Document store](https://github.com/donnemartin/system-design-primer#document-store)
|
||||
* [Wide column store](https://github.com/donnemartin/system-design-primer#wide-column-store)
|
||||
* [Graph database](https://github.com/donnemartin/system-design-primer#graph-database)
|
||||
* [SQL vs NoSQL](https://github.com/donnemartin/system-design-primer#sql-or-nosql)
|
||||
* [Key-value store](https://github.com/ido777/system-design-primer-update#key-value-store)
|
||||
* [Document store](https://github.com/ido777/system-design-primer-update#document-store)
|
||||
* [Wide column store](https://github.com/ido777/system-design-primer-update#wide-column-store)
|
||||
* [Graph database](https://github.com/ido777/system-design-primer-update#graph-database)
|
||||
* [SQL vs NoSQL](https://github.com/ido777/system-design-primer-update#sql-or-nosql)
|
||||
|
||||
### Caching
|
||||
|
||||
* Where to cache
|
||||
* [Client caching](https://github.com/donnemartin/system-design-primer#client-caching)
|
||||
* [CDN caching](https://github.com/donnemartin/system-design-primer#cdn-caching)
|
||||
* [Web server caching](https://github.com/donnemartin/system-design-primer#web-server-caching)
|
||||
* [Database caching](https://github.com/donnemartin/system-design-primer#database-caching)
|
||||
* [Application caching](https://github.com/donnemartin/system-design-primer#application-caching)
|
||||
* [Client caching](https://github.com/ido777/system-design-primer-update#client-caching)
|
||||
* [CDN caching](https://github.com/ido777/system-design-primer-update#cdn-caching)
|
||||
* [Web server caching](https://github.com/ido777/system-design-primer-update#web-server-caching)
|
||||
* [Database caching](https://github.com/ido777/system-design-primer-update#database-caching)
|
||||
* [Application caching](https://github.com/ido777/system-design-primer-update#application-caching)
|
||||
* What to cache
|
||||
* [Caching at the database query level](https://github.com/donnemartin/system-design-primer#caching-at-the-database-query-level)
|
||||
* [Caching at the object level](https://github.com/donnemartin/system-design-primer#caching-at-the-object-level)
|
||||
* [Caching at the database query level](https://github.com/ido777/system-design-primer-update#caching-at-the-database-query-level)
|
||||
* [Caching at the object level](https://github.com/ido777/system-design-primer-update#caching-at-the-object-level)
|
||||
* When to update the cache
|
||||
* [Cache-aside](https://github.com/donnemartin/system-design-primer#cache-aside)
|
||||
* [Write-through](https://github.com/donnemartin/system-design-primer#write-through)
|
||||
* [Write-behind (write-back)](https://github.com/donnemartin/system-design-primer#write-behind-write-back)
|
||||
* [Refresh ahead](https://github.com/donnemartin/system-design-primer#refresh-ahead)
|
||||
* [Cache-aside](https://github.com/ido777/system-design-primer-update#cache-aside)
|
||||
* [Write-through](https://github.com/ido777/system-design-primer-update#write-through)
|
||||
* [Write-behind (write-back)](https://github.com/ido777/system-design-primer-update#write-behind-write-back)
|
||||
* [Refresh ahead](https://github.com/ido777/system-design-primer-update#refresh-ahead)
|
||||
|
||||
### Asynchronism and microservices
|
||||
|
||||
* [Message queues](https://github.com/donnemartin/system-design-primer#message-queues)
|
||||
* [Task queues](https://github.com/donnemartin/system-design-primer#task-queues)
|
||||
* [Back pressure](https://github.com/donnemartin/system-design-primer#back-pressure)
|
||||
* [Microservices](https://github.com/donnemartin/system-design-primer#microservices)
|
||||
* [Message queues](https://github.com/ido777/system-design-primer-update#message-queues)
|
||||
* [Task queues](https://github.com/ido777/system-design-primer-update#task-queues)
|
||||
* [Back pressure](https://github.com/ido777/system-design-primer-update#back-pressure)
|
||||
* [Microservices](https://github.com/ido777/system-design-primer-update#microservices)
|
||||
|
||||
### Communications
|
||||
|
||||
* Discuss tradeoffs:
|
||||
* External communication with clients - [HTTP APIs following REST](https://github.com/donnemartin/system-design-primer#representational-state-transfer-rest)
|
||||
* Internal communications - [RPC](https://github.com/donnemartin/system-design-primer#remote-procedure-call-rpc)
|
||||
* [Service discovery](https://github.com/donnemartin/system-design-primer#service-discovery)
|
||||
* External communication with clients - [HTTP APIs following REST](https://github.com/ido777/system-design-primer-update#representational-state-transfer-rest)
|
||||
* Internal communications - [RPC](https://github.com/ido777/system-design-primer-update#remote-procedure-call-rpc)
|
||||
* [Service discovery](https://github.com/ido777/system-design-primer-update#service-discovery)
|
||||
|
||||
### Security
|
||||
|
||||
Refer to the [security section](https://github.com/donnemartin/system-design-primer#security).
|
||||
Refer to the [security section](https://github.com/ido777/system-design-primer-update#security).
|
||||
|
||||
### Latency numbers
|
||||
|
||||
See [Latency numbers every programmer should know](https://github.com/donnemartin/system-design-primer#latency-numbers-every-programmer-should-know).
|
||||
See [Latency numbers every programmer should know](https://github.com/ido777/system-design-primer-update#latency-numbers-every-programmer-should-know).
|
||||
|
||||
### Ongoing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user