From 5bf02395e721d1e24e065698b6a84109ef617a5a Mon Sep 17 00:00:00 2001 From: yanglbme Date: Wed, 28 Sep 2022 11:01:38 +0800 Subject: [PATCH] docs: update articles --- .../distributed-lock-redis-vs-zookeeper.md | 2 +- docs/high-availability/hystrix-fallback.md | 1 - .../high-availability/hystrix-introduction.md | 2 +- .../hystrix-thread-pool-current-limiting.md | 2 +- docs/high-concurrency/how-to-limit-current.md | 80 +++++++++---------- 5 files changed, 43 insertions(+), 44 deletions(-) diff --git a/docs/distributed-system/distributed-lock-redis-vs-zookeeper.md b/docs/distributed-system/distributed-lock-redis-vs-zookeeper.md index 558102a..a7d6ce5 100644 --- a/docs/distributed-system/distributed-lock-redis-vs-zookeeper.md +++ b/docs/distributed-system/distributed-lock-redis-vs-zookeeper.md @@ -272,7 +272,7 @@ public class ZooKeeperDistributedLock implements Watcher { // 如果不是最小的节点,找到比自己小1的节点 int previousLockIndex = -1; for (int i = 0; i < locks.size(); i++) { - if (lockNode.equals(locksRoot + “ /”+locks.get(i))){ + if (lockNode.equals(locksRoot + "/" +locks.get(i))){ previousLockIndex = i - 1; break; } diff --git a/docs/high-availability/hystrix-fallback.md b/docs/high-availability/hystrix-fallback.md index 9193250..0370970 100644 --- a/docs/high-availability/hystrix-fallback.md +++ b/docs/high-availability/hystrix-fallback.md @@ -32,7 +32,6 @@ Hystrix 出现以下四种情况,都会去调用 fallback 降级机制: * 品牌名称本地缓存 * */ - public class BrandCache { private static Map brandMap = new HashMap<>(); diff --git a/docs/high-availability/hystrix-introduction.md b/docs/high-availability/hystrix-introduction.md index 39b345f..f022334 100644 --- a/docs/high-availability/hystrix-introduction.md +++ b/docs/high-availability/hystrix-introduction.md @@ -46,6 +46,6 @@ Hystrix 可以对其进行资源隔离,比如限制服务 B 只有 40 个线 - 避免请求排队和积压,采用限流和 `fail fast` 来控制故障。 - 提供 fallback 降级机制来应对故障。 - 使用资源隔离技术,比如 `bulkhead`(舱壁隔离技术)、`swimlane`(泳道技术)、`circuit breaker`(断路技术)来限制任何一个依赖服务的故障的影响。 -- 通过近实时的统计/监控/报警功能,来提高故障发现的速度。 +- 通过近实时的统计、监控、报警功能,来提高故障发现的速度。 - 通过近实时的属性和配置**热修改**功能,来提高故障处理和恢复的速度。 - 保护依赖服务调用的所有故障情况,而不仅仅只是网络故障情况。 diff --git a/docs/high-availability/hystrix-thread-pool-current-limiting.md b/docs/high-availability/hystrix-thread-pool-current-limiting.md index 912ca53..fc3e14d 100644 --- a/docs/high-availability/hystrix-thread-pool-current-limiting.md +++ b/docs/high-availability/hystrix-thread-pool-current-limiting.md @@ -165,5 +165,5 @@ ProductInfo(id=null, name=降级商品, price=null, pictureList=null, specificat ProductInfo(id=null, name=降级商品, price=null, pictureList=null, specification=null, service=null, color=null, size=null, shopId=null, modifiedTime=null, cityId=null, cityName=null, brandId=null, brandName=null) {"id": -2, "name": "iphone7手机", "price": 5599, "pictureList":"a.jpg,b.jpg", "specification": "iphone7的规格", "service": "iphone7的售后服务", "color": "红色,白色,黑色", "size": "5.5", "shopId": 1, "modifiedTime": "2017-01-01 12:00:00", "cityId": 1, "brandId": 1} // 后面都是一些正常的商品信息,就不贴出来了 -//... +// ... ``` diff --git a/docs/high-concurrency/how-to-limit-current.md b/docs/high-concurrency/how-to-limit-current.md index a1d30f9..f868964 100644 --- a/docs/high-concurrency/how-to-limit-current.md +++ b/docs/high-concurrency/how-to-limit-current.md @@ -288,25 +288,25 @@ public class TokenBucket { ```yaml spring: - cloud: - gateway: - routes: - - id: requestratelimiter_route + cloud: + gateway: + routes: + - id: requestratelimiter_route + + uri: lb://pigx-upms + order: 10000 + predicates: + - Path=/admin/** + + filters: + - name: RequestRateLimiter + + args: + redis-rate-limiter.replenishRate: 1 # 令牌桶的容积 + redis-rate-limiter.burstCapacity: 3 # 流速 每秒 + key-resolver: '#{@remoteAddrKeyResolver}' #SPEL表达式去的对应的bean - uri: lb://pigx-upms - order: 10000 - predicates: - - Path=/admin/** - - filters: - - name: RequestRateLimiter - - args: - redis-rate-limiter.replenishRate: 1 # 令牌桶的容积 - redis-rate-limiter.burstCapacity: 3 # 流速 每秒 - key-resolver: '#{@remoteAddrKeyResolver}' #SPEL表达式去的对应的bean - - - StripPrefix=1 + - StripPrefix=1 ``` ```java @@ -329,22 +329,22 @@ KeyResolver remoteAddrKeyResolver() { ```yaml spring: - cloud: - nacos: - discovery: - server-addr: localhost:8848 - sentinel: - transport: - dashboard: localhost:8080 - port: 8720 - datasource: - ds: - nacos: - server-addr: localhost:8848 - dataId: spring-cloud-sentinel-nacos - groupId: DEFAULT_GROUP - rule-type: flow - namespace: xxxxxxxx + cloud: + nacos: + discovery: + server-addr: localhost:8848 + sentinel: + transport: + dashboard: localhost:8080 + port: 8720 + datasource: + ds: + nacos: + server-addr: localhost:8848 + dataId: spring-cloud-sentinel-nacos + groupId: DEFAULT_GROUP + rule-type: flow + namespace: xxxxxxxx ``` - 配置内容在 nacos 上进行编辑 @@ -352,12 +352,12 @@ spring: ```json [ { - "resource": "/hello", - "limitApp": "default", - "grade": 1, - "count": 1, - "strategy": 0, - "controlBehavior": 0, + "resource": "/hello", + "limitApp": "default", + "grade": 1, + "count": 1, + "strategy": 0, + "controlBehavior": 0, "clusterMode": false } ]