From 21dba3c56dbe92192051e21d78a3403b9558f28d Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 7 Nov 2024 14:42:56 +0800 Subject: [PATCH 01/12] add service-middleware config Signed-off-by: Ryan Leung --- pd-control.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/pd-control.md b/pd-control.md index 054e30d13b3a..211234b8e75e 100644 --- a/pd-control.md +++ b/pd-control.md @@ -470,6 +470,46 @@ config show cluster-version config set flow-round-by-digit 4 ``` +显示 service-middleware 的相关 config 信息: + +{{< copyable "" >}} + +```bash +config show service-middleware +``` + +``` +{ + "audit": { + "enable-audit": "true" + }, + "rate-limit": { + "enable-rate-limit": "true", + "limiter-config": {} + }, + "grpc-rate-limit": { + "enable-grpc-rate-limit": "true", + "grpc-limiter-config": {} + } +} +``` + +控制某个调用的 rate limit,以 GetRegion 调用为例: +```bash +config set service-middleware grpc-rate-limit GetRegion qps 100 +``` + +控制某个调用的并发,以 GetRegion 调用为例: +```bash +config set service-middleware grpc-rate-limit GetRegion concurrency 10 +``` + +重置上述设置 +```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#配置规则操作步骤)。 From 8e1b69b948a80186a909033cf276da66ac1fc89b Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 12 Nov 2024 15:53:04 +0800 Subject: [PATCH 02/12] address the comment Signed-off-by: Ryan Leung --- pd-control.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pd-control.md b/pd-control.md index 211234b8e75e..11f602ded3b1 100644 --- a/pd-control.md +++ b/pd-control.md @@ -504,6 +504,36 @@ config set service-middleware grpc-rate-limit GetRegion qps 100 config set service-middleware grpc-rate-limit GetRegion concurrency 10 ``` +查看修改后的配置 + +{{< copyable "" >}} + +```bash +config show service-middleware +``` + +``` +{ + "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, + "ConcurrencyLimit": 10 + } + } + } +} +``` + 重置上述设置 ```bash config set service-middleware grpc-rate-limit GetRegion qps 0 From dcd40824b32ac49a75d46cadc038d0470fc83120 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 12 Nov 2024 16:01:28 +0800 Subject: [PATCH 03/12] address the comment Signed-off-by: Ryan Leung --- pd-control.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pd-control.md b/pd-control.md index 11f602ded3b1..685b3f67d170 100644 --- a/pd-control.md +++ b/pd-control.md @@ -478,7 +478,7 @@ config show cluster-version config show service-middleware ``` -``` +```bash { "audit": { "enable-audit": "true" @@ -512,7 +512,7 @@ config set service-middleware grpc-rate-limit GetRegion concurrency 10 config show service-middleware ``` -``` +```bash { "audit": { "enable-audit": "true" From bc3cdf8292b0e091b0d9d5c34004d11d2258f850 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Mon, 18 Nov 2024 14:04:11 +0800 Subject: [PATCH 04/12] address comments Signed-off-by: Ryan Leung --- pd-control.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pd-control.md b/pd-control.md index 685b3f67d170..bdc56870a227 100644 --- a/pd-control.md +++ b/pd-control.md @@ -470,6 +470,12 @@ config show cluster-version config set flow-round-by-digit 4 ``` +service-middleware 是 PD 中间件服务配置模块,通常用于管理和控制服务的中间件功能,如审计、请求速率限制等。请求速率限制目前支持限制如下 gRPC API 请求: + +- GetRegion:获取指定 Region 的信息 +- GetStore:获取指定 Store 的信息 +- GetMembers:获取 PD 集群成员的信息 + 显示 service-middleware 的相关 config 信息: {{< copyable "" >}} @@ -494,20 +500,17 @@ config show service-middleware } ``` -控制某个调用的 rate limit,以 GetRegion 调用为例: +控制某个 gRPC API 请求的速率,以 `GetRegion` API 请求为例: ```bash config set service-middleware grpc-rate-limit GetRegion qps 100 ``` -控制某个调用的并发,以 GetRegion 调用为例: +控制某个 gRPC API 请求的并发,以 `GetRegion` API 请求为例: ```bash config set service-middleware grpc-rate-limit GetRegion concurrency 10 ``` -查看修改后的配置 - -{{< copyable "" >}} - +查看修改后的配置: ```bash config show service-middleware ``` @@ -534,7 +537,7 @@ config show service-middleware } ``` -重置上述设置 +重置上述设置: ```bash config set service-middleware grpc-rate-limit GetRegion qps 0 config set service-middleware grpc-rate-limit GetRegion concurrency 0 From 02f0452416e690a838ad0a143ca5863e5ae08d17 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Wed, 20 Nov 2024 15:48:36 +0800 Subject: [PATCH 05/12] update descriptions --- pd-control.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pd-control.md b/pd-control.md index bdc56870a227..584b6cf2a57f 100644 --- a/pd-control.md +++ b/pd-control.md @@ -470,15 +470,15 @@ config show cluster-version config set flow-round-by-digit 4 ``` -service-middleware 是 PD 中间件服务配置模块,通常用于管理和控制服务的中间件功能,如审计、请求速率限制等。请求速率限制目前支持限制如下 gRPC API 请求: +#### `config [show | set service-middleware