-
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?
Conversation
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Ryan Leung <[email protected]>
pd-control.md
Outdated
{{< copyable "" >}} | ||
|
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.
{{< copyable "" >}} |
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.
文档站目前默认会给所有代码加上复制按钮,所以不需要单独加 copyable 标识了
pd-control.md
Outdated
{{< copyable "" >}} | ||
|
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.
文档站目前默认会给所有代码加上复制按钮,所以不需要单独加 copyable 标识了
pd-control.md
Outdated
} | ||
``` | ||
|
||
控制某个调用的 rate limit,以 GetRegion 调用为例: |
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,以 GetRegion 调用为例: | |
控制某个调用的 rate limit,以 `GetRegion` 调用为例: | |
pd-control.md
Outdated
config set service-middleware grpc-rate-limit GetRegion qps 100 | ||
``` | ||
|
||
控制某个调用的并发,以 GetRegion 调用为例: |
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.
控制某个调用的并发,以 GetRegion 调用为例: | |
控制某个调用的并发度,以 `GetRegion` 调用为例: | |
pd-control.md
Outdated
查看修改后的配置 | ||
|
||
{{< copyable "" >}} |
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.
查看修改后的配置 | |
{{< copyable "" >}} | |
查看修改后的配置: |
pd-control.md
Outdated
} | ||
``` | ||
|
||
重置上述设置 |
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.
重置上述设置 | |
重置上述设置: | |
Signed-off-by: Ryan Leung <[email protected]>
"audit": { | ||
"enable-audit": "true" | ||
}, | ||
"rate-limit": { |
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.
Signed-off-by: Ryan Leung <[email protected]>
pd-control.md
Outdated
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计和请求速率限制等。从 v8.5.0 起,你可以通过 `service-middleware` 控制以下 gRPC API 请求的速率和并发度: | ||
> **注意:** | ||
> | ||
> 通常不建议用户对请求速率限制和并发限制进行修改,此类配置可能会引起业务报错。 |
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.
如果都不建议设置的话,可以放在
- audit: 审计功能
- rate-limit: 用于限制 HTTP API 请求的最大速率和最大并发
- grpc-rate-limit: 用于限制 gRPC API 请求的最大速率和最大并发
后面,就直接说不建议设置 rate-limit
/grpc-rate-limit
可以吧。这样就很明确了
pd-control.md
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
如果只能控制这三个的话,可以加下
你可以通过 `service-middleware grpc-rate-limit` 控制以下 gRPC API 请求的速率和并发度: | |
你可以通过 `service-middleware grpc-rate-limit` 控制以下三个 gRPC API 请求的速率和并发度: |
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.
这里不写“三个”也可以,不影响理解。而且,以后要是新增或减少了支持的 API 请求个数,也避免了忘记修改这里
pd-control.md
Outdated
"grpc-limiter-config": { | ||
"GetRegion": { | ||
"QPS": 100, | ||
"QPSBurst": 100, |
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.
这个好像也不太好解释
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.
那感觉就在注释里加上,仅作展示
就行了
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
pd-control.md
Outdated
"grpc-limiter-config": { | ||
"GetRegion": { | ||
"QPS": 100, | ||
"QPSBurst": 100, // 根据 QPS 设置自动调整 |
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.
"QPSBurst": 100, // 根据 QPS 设置自动调整 | |
"QPSBurst": 100, // 根据 QPS 设置自动调整,仅作展示 |
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.
/cc @qiancai 这个 ok 不
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.
rest lgtm
Signed-off-by: Ryan Leung <[email protected]>
pd-control.md
Outdated
|
||
> **注意:** | ||
> | ||
> 通常不建议用户对 service-middleware 中的配置进行修改。 |
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.
> 通常不建议用户对 service-middleware 中的配置进行修改。 | |
> 为了避免请求速率限制和并发限制对 PD 性能的影响,通常不建议用户对 `service-middleware` 中的配置进行修改。 |
pd-control.md
Outdated
|
||
|
||
|
||
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计,请求速率和并发限制等。从 v8.5.0 起,支持通过 pd-ctl 修改 `service-middleware` 配置, `option` 支持如下几种类型: |
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.
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计,请求速率和并发限制等。从 v8.5.0 起,支持通过 pd-ctl 修改 `service-middleware` 配置, `option` 支持如下几种类型: | |
`service-middleware` 是 PD 中的一个配置模块,主要用于管理和控制 PD 服务的中间件功能,如审计、请求速率限制和并发限制等。从 v8.5.0 起,PD 支持通过 `pd-ctl` 修改 `service-middleware` 的以下配置: |
pd-control.md
Outdated
- audit: 控制是否开启 HTTP 请求的审计日志。开启后,会在 PD 日志中记录 HTTP 请求的相关信息,默认开启 | ||
- rate-limit: 用于限制 HTTP API 请求的最大速率和最大并发 | ||
- grpc-rate-limit: 用于限制 gRPC API 请求的最大速率和最大并发 |
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.
- audit: 控制是否开启 HTTP 请求的审计日志。开启后,会在 PD 日志中记录 HTTP 请求的相关信息,默认开启 | |
- rate-limit: 用于限制 HTTP API 请求的最大速率和最大并发 | |
- grpc-rate-limit: 用于限制 gRPC API 请求的最大速率和最大并发 | |
- `audit`:控制是否开启 PD 处理 HTTP 请求的审计日志(默认开启)。开启时,`service-middleware` 会在 PD 日志中记录 HTTP 请求的相关信息。 | |
- `rate-limit`:用于限制 PD 处理 HTTP API 请求的最大速率和最大并发。 | |
- `grpc-rate-limit`:用于限制 PD 处理 gRPC API 请求的最大速率和最大并发。 |
pd-control.md
Outdated
你可以通过 `service-middleware audit` 控制审计功能: | ||
|
||
关闭审计功能 |
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.
你可以通过 `service-middleware audit` 控制审计功能: | |
关闭审计功能 | |
`service-middleware audit` 用于开启或关闭 HTTP 请求的日志审计功能。以关闭该功能为例: |
pd-control.md
Outdated
config set service-middleware audit enable-audit false | ||
``` | ||
|
||
你可以通过 `service-middleware grpc-rate-limit` 控制以下 gRPC API 请求的速率和并发度: |
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.
你可以通过 `service-middleware grpc-rate-limit` 控制以下 gRPC API 请求的速率和并发度: | |
`service-middleware grpc-rate-limit` 用于控制以下 gRPC API 请求的最大速率和并发度: |
pd-control.md
Outdated
config set service-middleware grpc-rate-limit GetRegion concurrency 0 | ||
``` | ||
|
||
同理,你可以通过 `service-middleware rate-limit` 控制以下 HTTP API 请求的速率和并发度: |
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.
同理,你可以通过 `service-middleware rate-limit` 控制以下 HTTP API 请求的速率和并发度: | |
`service-middleware rate-limit` 用于控制以下 HTTP API 请求的最大速率和并发度: |
Signed-off-by: Ryan Leung <[email protected]>
@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
||
> **注意:** | ||
> | ||
> 为了避免请求速率限制和并发限制对 PD 性能的影响,通常不建议用户对 `service-middleware` 中的配置进行修改。 |
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.
> 为了避免请求速率限制和并发限制对 PD 性能的影响,通常不建议用户对 `service-middleware` 中的配置进行修改。 | |
> 为了避免请求速率限制和并发限制对 PD 性能的影响,不建议修改 `service-middleware` 中的配置。 |
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.
Rest LGTM
First-time contributors' checklist
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions (in Chinese).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?