Skip to content

Commit 84bbe0b

Browse files
committed
docs(high-availability): update hystrix
更新 Hystrix 多个文件描述信息
1 parent 19cfea0 commit 84bbe0b

4 files changed

+8
-7
lines changed

docs/high-availability/hystrix-fallback.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class BrandCache {
4242

4343
/**
4444
* brandId 获取 brandName
45+
*
4546
* @param brandId 品牌id
4647
* @return 品牌名
4748
*/

docs/high-availability/hystrix-process.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ HystrixObservableCommand hystrixObservableCommand = new HystrixObservableCommand
4040
- toObservable():返回一个 Observable 对象,如果我们订阅这个对象,就会执行 command 并且获取返回结果。
4141

4242
```java
43-
K value = hystrixCommand.execute();
44-
Future<K> fValue = hystrixCommand.queue();
45-
Observable<K> oValue = hystrixObservableCommand.observe();
43+
K value = hystrixCommand.execute();
44+
Future<K> fValue = hystrixCommand.queue();
45+
Observable<K> oValue = hystrixObservableCommand.observe();
4646
Observable<K> toOValue = hystrixObservableCommand.toObservable();
4747
```
4848

@@ -106,7 +106,8 @@ observable.subscribe(new Observer<ProductInfo>() {
106106

107107
/**
108108
* 获取完一条数据,就回调一次这个方法
109-
* @param productInfo
109+
*
110+
* @param productInfo 商品信息
110111
*/
111112
@Override
112113
public void onNext(ProductInfo productInfo) {

docs/high-availability/hystrix-thread-pool-current-limiting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ semaphore 技术可以用来限流和削峰,但是不能用来对调研延迟
5858

5959
在 command 内部,写死代码,做一个 sleep,比如 sleep 3s。
6060

61-
- withCoreSize:设置线程池大小
62-
- withMaxQueueSize:设置等待队列大小
61+
- withCoreSize:设置线程池大小
62+
- withMaxQueueSize:设置等待队列大小
6363
- withQueueSizeRejectionThreshold:这个与 withMaxQueueSize 配合使用,等待队列的大小,取得是这两个参数的较小值。
6464

6565
如果只设置了线程池大小,另外两个 queue 相关参数没有设置的话,等待队列是处于关闭的状态。

docs/high-availability/hystrix-thread-pool-isolation.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## 基于 Hystrix 线程池技术实现资源隔离
2-
32
上一讲提到,如果从 Nginx 开始,缓存都失效了,Nginx 会直接通过缓存服务调用商品服务获取最新商品数据(我们基于电商项目做个讨论),有可能出现调用延时而把缓存服务资源耗尽的情况。这里,我们就来说说,怎么通过 Hystrix 线程池技术实现资源隔离。
43

54
资源隔离,就是说,你如果要把对某一个依赖服务的所有调用请求,全部隔离在同一份资源池内,不会去用其它资源了,这就叫资源隔离。哪怕对这个依赖服务,比如说商品服务,现在同时发起的调用量已经到了 1000,但是线程池内就 10 个线程,最多就只会用这 10 个线程去执行,不会说,对商品服务的请求,因为接口调用延时,将 tomcat 内部所有的线程资源全部耗尽。

0 commit comments

Comments
 (0)