From b77cc11b37d5c2a48dc8f70c005e0e3565fe2235 Mon Sep 17 00:00:00 2001 From: guide Date: Sat, 17 Oct 2020 16:42:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?add=20=E8=B6=85=E6=97=B6=E5=92=8C=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E6=9C=BA=E5=88=B6=20=E3=80=81=E9=9B=86=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e614dda..70626d0f 100644 --- a/README.md +++ b/README.md @@ -350,22 +350,36 @@ CAP 也就是 Consistency(一致性)、Availability(可用性)、Partiti #### 限流 +限流是从用户访问压力的角度来考虑如何应对系统故障。 + 限流为了对服务端的接口接受请求的频率进行限制,防止服务挂掉。比如某一接口的请求限制为 100 个每秒, 对超过限制的请求放弃处理或者放到队列中等待处理。限流可以有效应对突发请求过多。相关阅读:[限流算法有哪些?](docs/system-design/high-availability/limit-request.md) #### 降级 -限流是从用户访问压力的角度来考虑如何应对故障,降级是从系统功能优先级的角度考虑如何应对故障 +降级是从系统功能优先级的角度考虑如何应对系统故障。 -服务降级指的是当服务器压力剧增的情况下,根据当前业务情况及流量对一些服务和页面有策略的降级,以此释放服务器资源以保证核心任务的正常运行。降级往往会指定不同的级别,面临不同的异常等级执行不同的处理。根据服务方式:可以拒接服务,可以延迟服务,也有时候可以随机服务。根据服务范围:可以砍掉某个功能,也可以砍掉某些模块。总之服务降级需要根据不同的业务需求采用不同的降级策略。主要的目的就是服务虽然有损但是总比没有好。 +服务降级指的是当服务器压力剧增的情况下,根据当前业务情况及流量对一些服务和页面有策略的降级,以此释放服务器资源以保证核心任务的正常运行。 #### 熔断 -熔断和降级是两个比较容易混淆的概念,因为单纯从名字上看好像都有禁止某个功能的意思,但其实内在含义是不同的,原因在于降级的目的是应对系统自身的故障,而熔断的目的是应对依赖的外部系统故障的情况。 +熔断和降级是两个比较容易混淆的概念,两者的含义并不相同。 + +降级的目的在于应对系统自身的故障,而熔断的目的在于应对当前系统依赖的外部系统或者第三方系统的故障。 #### 排队 另类的一种限流,类比于现实世界的排队。玩过英雄联盟的小伙伴应该有体会,每次一有活动,就要经历一波排队才能进入游戏。 +#### 集群 + +相同的服务部署多份,避免单点故障。 + +#### 超时和重试机制 + +**一旦用户的请求超过某个时间得不到响应就结束此次请求并抛出异常。** 如果不进行超时设置可能会导致请求响应速度慢,甚至导致请求堆积进而让系统无法在处理请求。 + +另外,重试的次数一般设为 3 次,再多次的重试没有好处,反而会加重服务器压力(部分场景使用失败重试机制会不太适合)。 + ### 大型网站架构 - [8 张图读懂大型网站技术架构](docs/system-design/website-architecture/8%20张图读懂大型网站技术架构.md) From 5f920adf4f870652ecb463308455861c00df3b47 Mon Sep 17 00:00:00 2001 From: guide Date: Sat, 17 Oct 2020 16:54:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- .../spring/{spring-transaction.md => Spring事务总结.md} | 0 ...pringInterviewQuestions.md => Spring常见问题总结.md} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename docs/system-design/framework/spring/{spring-transaction.md => Spring事务总结.md} (100%) rename docs/system-design/framework/spring/{SpringInterviewQuestions.md => Spring常见问题总结.md} (100%) diff --git a/README.md b/README.md index 70626d0f..e2eed3dc 100644 --- a/README.md +++ b/README.md @@ -228,13 +228,13 @@ **知识点/面试题:** -1. **[Spring 常见问题总结](docs/system-design/framework/spring/SpringInterviewQuestions.md)** +1. **[Spring 常见问题总结](docs/system-design/framework/spring/Spring常见问题总结.md)** 2. **[SpringBoot 指南/常见面试题总结](https://github.com/Snailclimb/springboot-guide)** **重要知识点详解:** 1. **[Spring/Spring 常用注解总结!安排!](./docs/system-design/framework/spring/SpringBoot+Spring常用注解总结.md)** -2. **[Spring 事务总结](docs/system-design/framework/spring/spring-transaction.md)** +2. **[Spring 事务总结](docs/system-design/framework/spring/Spring事务总结.md)** 3. [Spring 中都用到了那些设计模式?](docs/system-design/framework/spring/Spring-Design-Patterns.md) #### MyBatis diff --git a/docs/system-design/framework/spring/spring-transaction.md b/docs/system-design/framework/spring/Spring事务总结.md similarity index 100% rename from docs/system-design/framework/spring/spring-transaction.md rename to docs/system-design/framework/spring/Spring事务总结.md diff --git a/docs/system-design/framework/spring/SpringInterviewQuestions.md b/docs/system-design/framework/spring/Spring常见问题总结.md similarity index 100% rename from docs/system-design/framework/spring/SpringInterviewQuestions.md rename to docs/system-design/framework/spring/Spring常见问题总结.md From 6bdfdd873340a84fd16e166f97c4f1e2ca39a1fb Mon Sep 17 00:00:00 2001 From: guide Date: Sat, 17 Oct 2020 17:01:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...么要网站有哪些常见的网站系统.md} | 0 .../api-gateway/如何设计一个亿级网关.md} | 0 .../zookeeper/images/curator.png | Bin .../zookeeper/images/watche机制.png | Bin .../zookeeper/images/znode-structure.png | Bin .../zookeeper/images/zookeeper集群.png | Bin .../images/zookeeper集群中的角色.png | Bin .../zookeeper/images/连接ZooKeeper服务.png | Bin .../zookeeper/zookeeper-in-action.md | 0 .../zookeeper/zookeeper-intro.md | 0 .../zookeeper/zookeeper-plus.md | 0 ...一个高可用系统要考虑哪些地方.md} | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename docs/system-design/{micro-service/api-gateway-intro.md => distributed-system/api-gateway/为什么要网站有哪些常见的网站系统.md} (100%) rename docs/system-design/{micro-service/API网关.md => distributed-system/api-gateway/如何设计一个亿级网关.md} (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/curator.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/watche机制.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/znode-structure.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/zookeeper集群.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/zookeeper集群中的角色.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/images/连接ZooKeeper服务.png (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/zookeeper-in-action.md (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/zookeeper-intro.md (100%) rename docs/system-design/{framework => distributed-system}/zookeeper/zookeeper-plus.md (100%) rename docs/system-design/high-availability/{如何设计一个高可用系统?要考虑哪些地方?.md => 如何设计一个高可用系统要考虑哪些地方.md} (100%) diff --git a/docs/system-design/micro-service/api-gateway-intro.md b/docs/system-design/distributed-system/api-gateway/为什么要网站有哪些常见的网站系统.md similarity index 100% rename from docs/system-design/micro-service/api-gateway-intro.md rename to docs/system-design/distributed-system/api-gateway/为什么要网站有哪些常见的网站系统.md diff --git a/docs/system-design/micro-service/API网关.md b/docs/system-design/distributed-system/api-gateway/如何设计一个亿级网关.md similarity index 100% rename from docs/system-design/micro-service/API网关.md rename to docs/system-design/distributed-system/api-gateway/如何设计一个亿级网关.md diff --git a/docs/system-design/framework/zookeeper/images/curator.png b/docs/system-design/distributed-system/zookeeper/images/curator.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/curator.png rename to docs/system-design/distributed-system/zookeeper/images/curator.png diff --git a/docs/system-design/framework/zookeeper/images/watche机制.png b/docs/system-design/distributed-system/zookeeper/images/watche机制.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/watche机制.png rename to docs/system-design/distributed-system/zookeeper/images/watche机制.png diff --git a/docs/system-design/framework/zookeeper/images/znode-structure.png b/docs/system-design/distributed-system/zookeeper/images/znode-structure.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/znode-structure.png rename to docs/system-design/distributed-system/zookeeper/images/znode-structure.png diff --git a/docs/system-design/framework/zookeeper/images/zookeeper集群.png b/docs/system-design/distributed-system/zookeeper/images/zookeeper集群.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/zookeeper集群.png rename to docs/system-design/distributed-system/zookeeper/images/zookeeper集群.png diff --git a/docs/system-design/framework/zookeeper/images/zookeeper集群中的角色.png b/docs/system-design/distributed-system/zookeeper/images/zookeeper集群中的角色.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/zookeeper集群中的角色.png rename to docs/system-design/distributed-system/zookeeper/images/zookeeper集群中的角色.png diff --git a/docs/system-design/framework/zookeeper/images/连接ZooKeeper服务.png b/docs/system-design/distributed-system/zookeeper/images/连接ZooKeeper服务.png similarity index 100% rename from docs/system-design/framework/zookeeper/images/连接ZooKeeper服务.png rename to docs/system-design/distributed-system/zookeeper/images/连接ZooKeeper服务.png diff --git a/docs/system-design/framework/zookeeper/zookeeper-in-action.md b/docs/system-design/distributed-system/zookeeper/zookeeper-in-action.md similarity index 100% rename from docs/system-design/framework/zookeeper/zookeeper-in-action.md rename to docs/system-design/distributed-system/zookeeper/zookeeper-in-action.md diff --git a/docs/system-design/framework/zookeeper/zookeeper-intro.md b/docs/system-design/distributed-system/zookeeper/zookeeper-intro.md similarity index 100% rename from docs/system-design/framework/zookeeper/zookeeper-intro.md rename to docs/system-design/distributed-system/zookeeper/zookeeper-intro.md diff --git a/docs/system-design/framework/zookeeper/zookeeper-plus.md b/docs/system-design/distributed-system/zookeeper/zookeeper-plus.md similarity index 100% rename from docs/system-design/framework/zookeeper/zookeeper-plus.md rename to docs/system-design/distributed-system/zookeeper/zookeeper-plus.md diff --git a/docs/system-design/high-availability/如何设计一个高可用系统?要考虑哪些地方?.md b/docs/system-design/high-availability/如何设计一个高可用系统要考虑哪些地方.md similarity index 100% rename from docs/system-design/high-availability/如何设计一个高可用系统?要考虑哪些地方?.md rename to docs/system-design/high-availability/如何设计一个高可用系统要考虑哪些地方.md From 513d08a0596682ed6ea32342c0e249b922f7423d Mon Sep 17 00:00:00 2001 From: guide Date: Sat, 17 Oct 2020 17:01:22 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e2eed3dc..8a89d065 100644 --- a/README.md +++ b/README.md @@ -278,8 +278,8 @@ RPC 让调用远程服务调用像调用本地方法那样简单。 网关主要用于请求转发、安全认证、协议转换、容灾。 -1. [为什么要网关?你知道有哪些常见的网关系统?](docs/system-design/micro-service/api-gateway-intro.md) -2. [如何设计一个亿级网关(API Gateway)?](docs/system-design/micro-service/API网关.md) +1. [为什么要网关?你知道有哪些常见的网关系统?](docs/system-design/distributed-system/api-gateway/为什么要网站有哪些常见的网站系统.md) +2. [如何设计一个亿级网关(API Gateway)?](docs/system-design/distributed-system/api-gateway/如何设计一个亿级网关.md) #### 分布式 id @@ -289,9 +289,9 @@ RPC 让调用远程服务调用像调用本地方法那样简单。 > 前两篇文章可能有内容重合部分,推荐都看一遍。 -1. [【入门】ZooKeeper 相关概念总结](docs/system-design/framework/zookeeper/zookeeper-intro.md) -2. [【进阶】ZooKeeper 相关概念总结](docs/system-design/framework/zookeeper/zookeeper-plus.md) -3. [【实战】ZooKeeper 实战](docs/system-design/framework/zookeeper/zookeeper-in-action.md) +1. [【入门】ZooKeeper 相关概念总结](docs/system-design/distributed-system/zookeeper/zookeeper-intro.md) +2. [【进阶】ZooKeeper 相关概念总结](docs/system-design/distributed-system/zookeeper/zookeeper-plus.md) +3. [【实战】ZooKeeper 实战](docs/system-design/distributed-system/zookeeper/zookeeper-in-action.md) ### 微服务 @@ -334,7 +334,7 @@ RPC 让调用远程服务调用像调用本地方法那样简单。 高可用描述的是一个系统在大部分时间都是可用的,可以为我们提供服务的。高可用代表系统即使在发生硬件故障或者系统升级的时候,服务仍然是可用的 。 -相关阅读: **《[如何设计一个高可用系统?要考虑哪些地方?](docs/system-design/high-availability/如何设计一个高可用系统?要考虑哪些地方?.md)》** 。 +相关阅读: **《[如何设计一个高可用系统?要考虑哪些地方?](docs/system-design/high-availability/如何设计一个高可用系统要考虑哪些地方.md)》** 。 #### CAP 理论