Skip to content

Commit 5b5a067

Browse files
committed
docs: add hystrix-thread-pool-current-limiting
- Update index.html - Add hystrix-thread-pool-current-limiting.md - Update hystrix-introduction and circuit-breaker
1 parent fce3c1f commit 5b5a067

7 files changed

+24
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
- [如何基于 Dubbo 进行服务治理、服务降级、失败重试以及超时重试?](/docs/distributed-system/dubbo-service-management.md)
6868
- [分布式服务接口的幂等性如何设计(比如不能重复扣款)?](/docs/distributed-system/distributed-system-idempotency.md)
6969
- [分布式服务接口请求的顺序性如何保证?](/docs/distributed-system/distributed-system-request-sequence.md)
70-
- [如何自己设计一个类似 Dubbo 的 rpc 框架?](/docs/distributed-system/dubbo-rpc-design.md)
70+
- [如何自己设计一个类似 Dubbo 的 RPC 框架?](/docs/distributed-system/dubbo-rpc-design.md)
7171

7272
### 分布式锁
7373
- [Zookeeper 都有哪些应用场景?](/docs/distributed-system/zookeeper-application-scenarios.md)
@@ -89,6 +89,7 @@
8989
- [基于 request cache 请求缓存技术优化批量商品数据查询接口](/docs/high-availability/hystrix-request-cache.md)
9090
- [基于本地缓存的 fallback 降级机制](/docs/high-availability/hystrix-fallback.md)
9191
- [深入 Hystrix 断路器执行原理](/docs/high-availability/hystrix-circuit-breaker.md)
92+
- [深入 Hystrix 线程池隔离与接口限流](/docs/high-availability/hystrix-thread-pool-current-limiting.md)
9293

9394
### 高可用系统
9495
- 如何设计一个高可用系统?

docs/high-availability/hystrix-circuit-breaker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ ProductInfo(id=1, name=iphone7手机, price=5599.0, pictureList=a.jpg,b.jpg, spe
172172
173173
之后的 9 次请求,都不会执行 run() 方法,也就不会打印以下信息。
174174
175-
```
175+
```c
176176
调用接口查询商品数据,productId=-1
177177
```
178178

docs/high-availability/hystrix-introduction.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 用 Hystrix 构建高可用服务架构
2+
参考 [Hystrix Home](https://github.com/Netflix/Hystrix/wiki#what)
23

34
### Hystrix 是什么?
45
在分布式系统中,每个服务都可能会调用很多其他服务,被调用的那些服务就是**依赖服务**,有的时候某些依赖服务出现故障也是很正常的。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## 深入 Hystrix 线程池隔离与接口限流
2+
前面讲了 Hystrix 的 request cache 请求缓存、fallback 优雅降级、circuit breaker 断路器快速熔断,这一讲,我们来详细说说 Hystrix 的线程池隔离与接口限流。
3+
4+
![hystrix-process](/img/hystrix-process.png)
5+
6+
Hystrix 通过判断线程池或者信号量是否已满,超出容量的请求,直接 Reject 走降级,从而达到限流的作用。
7+
8+
限流是限制对后端的服务的访问量,比如说你对 MySQL、Redis、Zookeeper 以及其它各种后端中间件的资源的访问的限制,其实是为了避免过大的流量直接打死后端的服务。
9+
10+
### 线程池隔离技术的设计
11+
Hystrix 采用了 Bulkhead Partition 舱壁隔离技术,来将外部依赖进行资源隔离,进而避免任何外部依赖的故障导致本服务崩溃。
12+
13+
> **舱壁隔离**,是说将船体内部空间区隔划分成若干个隔舱,一旦某几个隔舱发生破损进水,水流不会在其间相互流动,如此一来船舶在受损时,依然能具有足够的浮力和稳定性,进而减低立即沉船的危险。
14+
15+
![bulkhead-partition](/img/bulkhead-partition.jpg)
16+
17+
Hystrix 对每个外部依赖用一个单独的线程池,这样的话,如果对那个外部依赖调用延迟很严重,最多就是耗尽那个依赖自己的线程池而已,不会影响其他的依赖调用。
18+
19+
### Hystrix 应用线程池机制的场景
Loading

img/bulkhead-partition.jpg

6.89 KB
Loading

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
5454
<script src="//unpkg.com/prismjs/components/prism-java.min.js"></script>
5555
<script src="//unpkg.com/prismjs/components/prism-python.min.js"></script>
56+
<script src="//unpkg.com/docsify-copy-code"></script>
5657
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
5758
<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
5859
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>

0 commit comments

Comments
 (0)