-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
21dba3c
8e1b69b
dcd4082
bc3cdf8
02f0452
fe1fed8
c183275
d0ed94a
6f419e5
d1f37ce
aaddac7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -470,13 +470,17 @@ config show cluster-version | |||||||||
config set flow-round-by-digit 4 | ||||||||||
``` | ||||||||||
|
||||||||||
#### `config [show | set service-middleware <option> <value>]` | ||||||||||
#### `config [show | set service-middleware <option> [<key> <value> | <label> <qps|concurrency> <value>]]` | ||||||||||
|
||||||||||
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计和请求速率限制等。从 v8.5.0 起,你可以通过 `service-middleware` 控制以下 gRPC API 请求的速率和并发度: | ||||||||||
> **注意:** | ||||||||||
> | ||||||||||
> 通常不建议用户对请求速率限制和并发限制进行修改,此类配置可能会引起业务报错。 | ||||||||||
|
||||||||||
- `GetRegion`:获取指定 Region 的信息 | ||||||||||
- `GetStore`:获取指定 Store 的信息 | ||||||||||
- `GetMembers`:获取 PD 集群成员的信息 | ||||||||||
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计和请求速率限制等。从 v8.5.0 起,支持通过 pd-ctl 修改 `service-middleware` 配置, `option` 支持如下几种类型: | ||||||||||
|
||||||||||
- audit: 审计功能 | ||||||||||
- rate-limit: HTTP API 请求速率限制功能 | ||||||||||
okJiang marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- grpc-rate-limit: gRPC API 请求速率限制功能 | ||||||||||
|
||||||||||
显示 `service-middleware` 的相关 config 信息: | ||||||||||
|
||||||||||
|
@@ -500,6 +504,20 @@ config show service-middleware | |||||||||
} | ||||||||||
``` | ||||||||||
|
||||||||||
qiancai marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
你可以通过 `service-middleware audit` 控制审计功能: | ||||||||||
|
||||||||||
开启审计功能 | ||||||||||
|
||||||||||
```bash | ||||||||||
config set service-middleware audit enable-audit true | ||||||||||
``` | ||||||||||
|
||||||||||
你可以通过 `service-middleware grpc-rate-limit` 控制以下 gRPC API 请求的速率和并发度: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 如果只能控制这三个的话,可以加下
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不是,只暴露三个 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里不写“三个”也可以,不影响理解。而且,以后要是新增或减少了支持的 API 请求个数,也避免了忘记修改这里 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
- `GetRegion`:获取指定 Region 的信息 | ||||||||||
- `GetStore`:获取指定 Store 的信息 | ||||||||||
- `GetMembers`:获取 PD 集群成员的信息 | ||||||||||
|
||||||||||
控制某个 gRPC API 请求的速率,以 `GetRegion` API 请求为例: | ||||||||||
okJiang marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
```bash | ||||||||||
|
@@ -547,6 +565,30 @@ config set service-middleware grpc-rate-limit GetRegion qps 0 | |||||||||
config set service-middleware grpc-rate-limit GetRegion concurrency 0 | ||||||||||
``` | ||||||||||
|
||||||||||
同理,你可以通过 `service-middleware rate-limit` 控制以下 HTTP API 请求的速率和并发度: | ||||||||||
okJiang marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
- `GetRegion`:获取指定 Region 的信息 | ||||||||||
- `GetStore`:获取指定 Store 的信息 | ||||||||||
|
||||||||||
控制某个 HTTP API 请求的速率,以 `GetRegion` API 请求为例: | ||||||||||
|
||||||||||
```bash | ||||||||||
config set service-middleware rate-limit GetRegion qps 100 | ||||||||||
``` | ||||||||||
|
||||||||||
控制某个 HTTP API 请求的并发度,以 `GetRegion` API 请求为例: | ||||||||||
|
||||||||||
```bash | ||||||||||
config set service-middleware rate-limit GetRegion concurrency 10 | ||||||||||
``` | ||||||||||
|
||||||||||
重置上述设置: | ||||||||||
|
||||||||||
```bash | ||||||||||
config set service-middleware rate-limit GetRegion qps 0 | ||||||||||
config set service-middleware rate-limit GetRegion concurrency 0 | ||||||||||
``` | ||||||||||
|
||||||||||
### `config placement-rules [disable | enable | load | save | show | rule-group]` | ||||||||||
|
||||||||||
关于 `config placement-rules` 的具体用法,参考 [Placement Rules 使用文档](/configure-placement-rules.md#配置规则操作步骤)。 | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是不是太严重了😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一段可以放在后面一点的位置,放在前面,用户还不知道
请求速率限制和并发限制
是什么There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还有,
请求速率限制和并发限制
是 HTTP 的还是 gRPC 的,还是都不建议使用?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
都不建议
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
放在后面感觉不够警示?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果都不建议设置的话,可以放在
后面,就直接说不建议设置
rate-limit
/grpc-rate-limit
可以吧。这样就很明确了