Skip to content

Commit

Permalink
docs: update articles
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed Sep 28, 2022
1 parent 0a52be9 commit 5bf0239
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion docs/high-availability/hystrix-fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Hystrix 出现以下四种情况,都会去调用 fallback 降级机制:
* 品牌名称本地缓存
*
*/

public class BrandCache {

private static Map<Long, String> brandMap = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion docs/high-availability/hystrix-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ Hystrix 可以对其进行资源隔离,比如限制服务 B 只有 40 个线
- 避免请求排队和积压,采用限流和 `fail fast` 来控制故障。
- 提供 fallback 降级机制来应对故障。
- 使用资源隔离技术,比如 `bulkhead`(舱壁隔离技术)、`swimlane`(泳道技术)、`circuit breaker`(断路技术)来限制任何一个依赖服务的故障的影响。
- 通过近实时的统计/监控/报警功能,来提高故障发现的速度。
- 通过近实时的统计、监控、报警功能,来提高故障发现的速度。
- 通过近实时的属性和配置**热修改**功能,来提高故障处理和恢复的速度。
- 保护依赖服务调用的所有故障情况,而不仅仅只是网络故障情况。
Original file line number Diff line number Diff line change
Expand Up @@ -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}
// 后面都是一些正常的商品信息,就不贴出来了
//...
// ...
```
82 changes: 41 additions & 41 deletions docs/high-concurrency/how-to-limit-current.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,25 +288,25 @@ public class TokenBucket {

```yaml
spring:
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

- StripPrefix=1
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

- StripPrefix=1
```

```java
Expand All @@ -329,35 +329,35 @@ 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 上进行编辑

```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
}
]
Expand Down

0 comments on commit 5bf0239

Please sign in to comment.