Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service-middleware config for pd-ctl #19023

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
70 changes: 70 additions & 0 deletions pd-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,76 @@ config show cluster-version
config set flow-round-by-digit 4
```

显示 service-middleware 的相关 config 信息:
qiancai marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "" >}}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{< copyable "" >}}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档站目前默认会给所有代码加上复制按钮,所以不需要单独加 copyable 标识了

```bash
config show service-middleware
```

```bash
{
"audit": {
"enable-audit": "true"
},
"rate-limit": {
Copy link
Contributor

@niubell niubell Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rleungx 上面@okJiang 说的有道理,我们在执行 command show 的时候能不能把 audit、rate-limiter 都隐藏掉呢?否则容易误用,既:文档里不暴露,命令行里(或者server 侧直接禁用掉、不返回)也隐藏掉

"enable-rate-limit": "true",
"limiter-config": {}
},
"grpc-rate-limit": {
"enable-grpc-rate-limit": "true",
"grpc-limiter-config": {}
}
}
```

qiancai marked this conversation as resolved.
Show resolved Hide resolved
控制某个调用的 rate limit,以 GetRegion 调用为例:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
控制某个调用的 rate limit,以 GetRegion 调用为例:
控制某个调用的 rate limit,以 `GetRegion` 调用为例:

```bash
config set service-middleware grpc-rate-limit GetRegion qps 100
qiancai marked this conversation as resolved.
Show resolved Hide resolved
```

控制某个调用的并发,以 GetRegion 调用为例:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
控制某个调用的并发,以 GetRegion 调用为例:
控制某个调用的并发度,以 `GetRegion` 调用为例:

```bash
config set service-middleware grpc-rate-limit GetRegion concurrency 10
```

查看修改后的配置

{{< copyable "" >}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
查看修改后的配置
{{< copyable "" >}}
查看修改后的配置:


```bash
config show service-middleware
```

```bash
{
"audit": {
"enable-audit": "true"
},
"rate-limit": {
"enable-rate-limit": "true",
"limiter-config": {}
},
"grpc-rate-limit": {
"enable-grpc-rate-limit": "true",
"grpc-limiter-config": {
"GetRegion": {
"QPS": 100,
"QPSBurst": 100,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是作什么用的呢?不能设置?

可以加个注释

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不能设置

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个好像也不太好解释

Copy link
Member

@okJiang okJiang Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那感觉就在注释里加上,仅作展示就行了

"ConcurrencyLimit": 10
}
}
}
}
```

重置上述设置
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
重置上述设置
重置上述设置

```bash
config set service-middleware grpc-rate-limit GetRegion qps 0
config set service-middleware grpc-rate-limit GetRegion concurrency 0
```

### `config placement-rules [disable | enable | load | save | show | rule-group]`

关于 `config placement-rules` 的具体用法,参考 [Placement Rules 使用文档](/configure-placement-rules.md#配置规则操作步骤)。
Expand Down