From 0599d552a0bb098d958bbe71dce2c5022691402a Mon Sep 17 00:00:00 2001 From: glorv Date: Thu, 19 Sep 2024 15:03:18 +0800 Subject: [PATCH 1/7] add document for background reousrce limit --- dynamic-config.md | 1 + .../sql-statement-alter-resource-group.md | 17 ++++++++-------- tidb-resource-control.md | 20 +++++++++---------- tikv-configuration-file.md | 10 ++++++++++ 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/dynamic-config.md b/dynamic-config.md index 5f5299a44e116..94a684e484c17 100644 --- a/dynamic-config.md +++ b/dynamic-config.md @@ -169,6 +169,7 @@ The following TiKV configuration items can be modified dynamically: | `readpool.unified.max-thread-count` | The maximum number of threads in the thread pool that uniformly processes read requests, which is the size of the UnifyReadPool thread pool | | `readpool.unified.max-tasks-per-worker` | The maximum number of tasks allowed for a single thread in the unified read pool. `Server Is Busy` error is returned when the value is exceeded. | | `readpool.unified.auto-adjust-pool-size` | Determines whether to automatically adjust the UnifyReadPool thread pool size | +| `resource-control.priority-ctl-strategy` | Config the control strategy of low-priority tasks. | | `coprocessor.split-region-on-table` | Enables to split Region by table | | `coprocessor.batch-split-limit` | The threshold of Region split in batches | | `coprocessor.region-max-size` | The maximum size of a Region | diff --git a/sql-statements/sql-statement-alter-resource-group.md b/sql-statements/sql-statement-alter-resource-group.md index 8b2f521c9b1ff..ffc3aa22d325f 100644 --- a/sql-statements/sql-statement-alter-resource-group.md +++ b/sql-statements/sql-statement-alter-resource-group.md @@ -30,7 +30,7 @@ ResourceGroupOptionList ::= | ResourceGroupOptionList ',' DirectResourceGroupOption DirectResourceGroupOption ::= - "RU_PER_SEC" EqOpt stringLit + "RU_PER_SEC" EqOpt LengthNum | "PRIORITY" EqOpt ResourceGroupPriorityOption | "BURSTABLE" | "BURSTABLE" EqOpt Boolean @@ -72,6 +72,7 @@ BackgroundOptionList ::= DirectBackgroundOption ::= "TASK_TYPES" EqOpt stringLit +| "UTILIZATION_LIMIT" EqOpt LengthNum ``` TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU)](/tidb-resource-control.md#what-is-request-unit-ru) is a unified abstraction unit in TiDB for CPU, IO, and other system resources. @@ -82,7 +83,7 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | `PRIORITY` | The absolute priority of tasks to be processed on TiKV | `PRIORITY = HIGH` indicates that the priority is high. If not specified, the default value is `MEDIUM`. | | `BURSTABLE` | If the `BURSTABLE` attribute is set, TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. | | `QUERY_LIMIT` | When the query execution meets this condition, the query is identified as a runaway query and the corresponding action is executed. | `QUERY_LIMIT=(EXEC_ELAPSED='60s', ACTION=KILL, WATCH=EXACT DURATION='10m')` indicates that the query is identified as a runaway query when the execution time exceeds 60 seconds. The query is terminated. All SQL statements with the same SQL text will be terminated immediately in the coming 10 minutes. `QUERY_LIMIT=()` or `QUERY_LIMIT=NULL` means that runaway control is not enabled. See [Runaway Queries](/tidb-resource-control.md#manage-queries-that-consume-more-resources-than-expected-runaway-queries). | -| `BACKGROUND` | Configure the background tasks. For more details, see [Manage background tasks](/tidb-resource-control.md#manage-background-tasks). | `BACKGROUND=(TASK_TYPES="br,stats")` indicates that the backup and restore and statistics collection related tasks are scheduled as background tasks. | +| `BACKGROUND` | Configure the background tasks. For more details, see [Manage background tasks](/tidb-resource-control.md#manage-background-tasks). | `BACKGROUND=(TASK_TYPES="br,stats", UTILIZATION_LIMIT=30)` indicates that the backup and restore and statistics collection related tasks are scheduled as background tasks and background tasks can consume 30% of the resources of TiKV at most. | > **Note:** > @@ -152,7 +153,7 @@ SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1'; Modify the `BACKGROUND` option for the `default` resource group. ```sql -ALTER RESOURCE GROUP default BACKGROUND = (TASK_TYPES = "br,ddl"); +ALTER RESOURCE GROUP default BACKGROUND = (TASK_TYPES = "br,ddl", UTILIZATION_LIMIT=30); ``` ```sql @@ -164,11 +165,11 @@ SELECT * FROM information_schema.resource_groups WHERE NAME ='default'; ``` ```sql -+---------+------------+----------+-----------+-------------+---------------------+ -| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND | -+---------+------------+----------+-----------+-------------+---------------------+ -| default | UNLIMITED | MEDIUM | YES | NULL | TASK_TYPES='br,ddl' | -+---------+------------+----------+-----------+-------------+---------------------+ ++---------+------------+----------+-----------+-------------+-------------------------------------------+ +| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND | ++---------+------------+----------+-----------+-------------+-------------------------------------------+ +| default | UNLIMITED | MEDIUM | YES | NULL | TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30 | ++---------+------------+----------+-----------+-------------+-------------------------------------------+ 1 rows in set (1.30 sec) ``` diff --git a/tidb-resource-control.md b/tidb-resource-control.md index 547228739ba2b..3ae206bfb5569 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -401,8 +401,6 @@ You can get more information about runaway queries from the following system tab ### Manage background tasks > **Warning:** -> -> This feature is experimental. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://docs.pingcap.com/tidb/stable/support) on GitHub. > > The background task management in resource control is based on TiKV's dynamic adjustment of resource quotas for CPU/IO utilization. Therefore, it relies on the available resource quota of each instance. If multiple components or instances are deployed on a single server, it is mandatory to set the appropriate resource quota for each instance through `cgroup`. It is difficult to achieve the expected effect in deployment with shared resources like TiUP Playground. @@ -412,7 +410,9 @@ Starting from v7.4.0, the TiDB resource control feature supports managing backgr #### `BACKGROUND` parameters -`TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. +- `TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. +- `UTILIZATION_LIMIT`: specifies the maximum resource percentage(0-100) of each TiKV instance that background tasks can consume. By default, +the resource granted for background tasks are calculated based on the total resource quota and current foreground workload dynamically, if `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. TiDB supports the following types of background tasks: @@ -444,10 +444,10 @@ By default, the task types that are marked as background tasks are `""`, and the #### Examples -1. Modify the `default` resource group and mark `br` and `ddl` as background tasks. +1. Modify the `default` resource group and mark `br` and `ddl` as background tasks and set background tasks resource limit to 30%. ```sql - ALTER RESOURCE GROUP `default` BACKGROUND=(TASK_TYPES='br,ddl'); + ALTER RESOURCE GROUP `default` BACKGROUND=(TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30); ``` 2. Change the `default` resource group to revert the background task type to its default value. @@ -471,11 +471,11 @@ By default, the task types that are marked as background tasks are `""`, and the The output is as follows: ``` - +---------+------------+----------+-----------+-------------+---------------------+ - | NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND | - +---------+------------+----------+-----------+-------------+---------------------+ - | default | UNLIMITED | MEDIUM | YES | NULL | TASK_TYPES='br,ddl' | - +---------+------------+----------+-----------+-------------+---------------------+ + +---------+------------+----------+-----------+-------------+-------------------------------------------+ + | NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND | + +---------+------------+----------+-----------+-------------+-------------------------------------------+ + | default | UNLIMITED | MEDIUM | YES | NULL | TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30 | + +---------+------------+----------+-----------+-------------+-------------------------------------------+ ``` 5. To explicitly mark tasks in the current session as the background type, you can use `tidb_request_source_type` to explicitly specify the task type. The following is an example: diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index f07fdd1ca6c08..cab720ae8a9b1 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -2426,6 +2426,16 @@ Configuration items related to resource control of the TiKV storage layer. + Enabling this configuration item only works when [`tidb_enable_resource_control](/system-variables.md#tidb_enable_resource_control-new-in-v660) is enabled on TiDB. When this configuration item is enabled, TiKV will use the priority queue to schedule the queued read/write requests from foreground users. The scheduling priority of a request is inversely related to the amount of resources already consumed by the resource group that receives this request, and positively related to the quota of the corresponding resource group. + Default value: `true`, which means scheduling based on the RU of the resource group is enabled. +### `priority-ctl-strategy` 从 v8.4.0 版本开始引入 + +Configure the control strategy for low priority tasks. TiKV ensures the priority execution of higher priority tasks by applying dynamic quota limit to low-priority tasks. This control strategy is used to calculates the quota for low priority tasks. + ++ Value Options: + + `aggressive`: using this strategy, the flow control policy will prioritize the performance of high-priority tasks, ensuring that the throughput and latency of high-priority tasks are basically unaffected, but low-priority tasks will run slower. + + `moderate`: using this strategy, TiKV will impose a balanced flow control limit on low-priority tasks, ensuring that low-priority tasks can use more system available resources while causing little impact on high-priority tasks. + + `conservative`: using this strategy, the flow control policy will prioritize ensuring that system resources are fully utilized, and low-priority tasks will try to use available system resources as much as possible, resulting in a greater impact on the performance of high-priority tasks. ++ Default value: `moderate`. + ## split Configuration items related to [Load Base Split](/configure-load-base-split.md). From f8b41f406c73b7b09419678b13c909ba24a52de8 Mon Sep 17 00:00:00 2001 From: glorv Date: Thu, 19 Sep 2024 15:13:36 +0800 Subject: [PATCH 2/7] fix --- tidb-resource-control.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tidb-resource-control.md b/tidb-resource-control.md index 3ae206bfb5569..eff394553ec29 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -411,8 +411,7 @@ Starting from v7.4.0, the TiDB resource control feature supports managing backgr #### `BACKGROUND` parameters - `TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. -- `UTILIZATION_LIMIT`: specifies the maximum resource percentage(0-100) of each TiKV instance that background tasks can consume. By default, -the resource granted for background tasks are calculated based on the total resource quota and current foreground workload dynamically, if `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. +- `UTILIZATION_LIMIT`: specifies the maximum resource percentage(0-100) of each TiKV instance that background tasks can consume. By default, the resource granted for background tasks are calculated based on the total resource quota and current foreground workload dynamically, if `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. TiDB supports the following types of background tasks: From f90f0c7dee9230c57d1b5a5d696bb6a2e5913f06 Mon Sep 17 00:00:00 2001 From: glorv Date: Tue, 24 Sep 2024 11:40:12 +0800 Subject: [PATCH 3/7] add back experimental warning --- tidb-resource-control.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tidb-resource-control.md b/tidb-resource-control.md index eff394553ec29..fe1551ba84dd8 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -401,6 +401,8 @@ You can get more information about runaway queries from the following system tab ### Manage background tasks > **Warning:** +> +> This feature is experimental. It is not recommended that you use it in the production environment. This feature might be changed or removed without prior notice. If you find a bug, you can report an [issue](https://docs.pingcap.com/tidb/stable/support) on GitHub. > > The background task management in resource control is based on TiKV's dynamic adjustment of resource quotas for CPU/IO utilization. Therefore, it relies on the available resource quota of each instance. If multiple components or instances are deployed on a single server, it is mandatory to set the appropriate resource quota for each instance through `cgroup`. It is difficult to achieve the expected effect in deployment with shared resources like TiUP Playground. From de113b5c8d8d593c9e525ff94ce48c75c5549f17 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Tue, 24 Sep 2024 11:42:07 +0800 Subject: [PATCH 4/7] Apply suggestions from code review --- dynamic-config.md | 2 +- sql-statements/sql-statement-alter-resource-group.md | 2 +- tidb-resource-control.md | 4 ++-- tikv-configuration-file.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dynamic-config.md b/dynamic-config.md index 94a684e484c17..266366b9a587c 100644 --- a/dynamic-config.md +++ b/dynamic-config.md @@ -169,7 +169,7 @@ The following TiKV configuration items can be modified dynamically: | `readpool.unified.max-thread-count` | The maximum number of threads in the thread pool that uniformly processes read requests, which is the size of the UnifyReadPool thread pool | | `readpool.unified.max-tasks-per-worker` | The maximum number of tasks allowed for a single thread in the unified read pool. `Server Is Busy` error is returned when the value is exceeded. | | `readpool.unified.auto-adjust-pool-size` | Determines whether to automatically adjust the UnifyReadPool thread pool size | -| `resource-control.priority-ctl-strategy` | Config the control strategy of low-priority tasks. | +| `resource-control.priority-ctl-strategy` | Configures the control strategy of low-priority tasks. | | `coprocessor.split-region-on-table` | Enables to split Region by table | | `coprocessor.batch-split-limit` | The threshold of Region split in batches | | `coprocessor.region-max-size` | The maximum size of a Region | diff --git a/sql-statements/sql-statement-alter-resource-group.md b/sql-statements/sql-statement-alter-resource-group.md index ffc3aa22d325f..b8949255185b5 100644 --- a/sql-statements/sql-statement-alter-resource-group.md +++ b/sql-statements/sql-statement-alter-resource-group.md @@ -83,7 +83,7 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | `PRIORITY` | The absolute priority of tasks to be processed on TiKV | `PRIORITY = HIGH` indicates that the priority is high. If not specified, the default value is `MEDIUM`. | | `BURSTABLE` | If the `BURSTABLE` attribute is set, TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. | | `QUERY_LIMIT` | When the query execution meets this condition, the query is identified as a runaway query and the corresponding action is executed. | `QUERY_LIMIT=(EXEC_ELAPSED='60s', ACTION=KILL, WATCH=EXACT DURATION='10m')` indicates that the query is identified as a runaway query when the execution time exceeds 60 seconds. The query is terminated. All SQL statements with the same SQL text will be terminated immediately in the coming 10 minutes. `QUERY_LIMIT=()` or `QUERY_LIMIT=NULL` means that runaway control is not enabled. See [Runaway Queries](/tidb-resource-control.md#manage-queries-that-consume-more-resources-than-expected-runaway-queries). | -| `BACKGROUND` | Configure the background tasks. For more details, see [Manage background tasks](/tidb-resource-control.md#manage-background-tasks). | `BACKGROUND=(TASK_TYPES="br,stats", UTILIZATION_LIMIT=30)` indicates that the backup and restore and statistics collection related tasks are scheduled as background tasks and background tasks can consume 30% of the resources of TiKV at most. | +| `BACKGROUND` | Configure the background tasks. For more details, see [Manage background tasks](/tidb-resource-control.md#manage-background-tasks). | `BACKGROUND=(TASK_TYPES="br,stats", UTILIZATION_LIMIT=30)` indicates that the backup and restore and statistics collection related tasks are scheduled as background tasks, and background tasks can consume 30% of the TiKV resources at most. | > **Note:** > diff --git a/tidb-resource-control.md b/tidb-resource-control.md index fe1551ba84dd8..8e630eb2f9084 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -413,7 +413,7 @@ Starting from v7.4.0, the TiDB resource control feature supports managing backgr #### `BACKGROUND` parameters - `TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. -- `UTILIZATION_LIMIT`: specifies the maximum resource percentage(0-100) of each TiKV instance that background tasks can consume. By default, the resource granted for background tasks are calculated based on the total resource quota and current foreground workload dynamically, if `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. +- `UTILIZATION_LIMIT`: specifies the maximum resource percentage (0-100) of each TiKV instance that background tasks can consume. By default, the resource granted for background tasks are calculated based on the total resource quota and the current foreground workload dynamically. If `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. TiDB supports the following types of background tasks: @@ -445,7 +445,7 @@ By default, the task types that are marked as background tasks are `""`, and the #### Examples -1. Modify the `default` resource group and mark `br` and `ddl` as background tasks and set background tasks resource limit to 30%. +1. Modify the `default` resource group and mark `br` and `ddl` as background tasks, and set background tasks resource limit to 30%. ```sql ALTER RESOURCE GROUP `default` BACKGROUND=(TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30); diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index cab720ae8a9b1..3667928326f86 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -2426,11 +2426,11 @@ Configuration items related to resource control of the TiKV storage layer. + Enabling this configuration item only works when [`tidb_enable_resource_control](/system-variables.md#tidb_enable_resource_control-new-in-v660) is enabled on TiDB. When this configuration item is enabled, TiKV will use the priority queue to schedule the queued read/write requests from foreground users. The scheduling priority of a request is inversely related to the amount of resources already consumed by the resource group that receives this request, and positively related to the quota of the corresponding resource group. + Default value: `true`, which means scheduling based on the RU of the resource group is enabled. -### `priority-ctl-strategy` 从 v8.4.0 版本开始引入 +### `priority-ctl-strategy` New in v8.4.0 Configure the control strategy for low priority tasks. TiKV ensures the priority execution of higher priority tasks by applying dynamic quota limit to low-priority tasks. This control strategy is used to calculates the quota for low priority tasks. -+ Value Options: ++ Value options: + `aggressive`: using this strategy, the flow control policy will prioritize the performance of high-priority tasks, ensuring that the throughput and latency of high-priority tasks are basically unaffected, but low-priority tasks will run slower. + `moderate`: using this strategy, TiKV will impose a balanced flow control limit on low-priority tasks, ensuring that low-priority tasks can use more system available resources while causing little impact on high-priority tasks. + `conservative`: using this strategy, the flow control policy will prioritize ensuring that system resources are fully utilized, and low-priority tasks will try to use available system resources as much as possible, resulting in a greater impact on the performance of high-priority tasks. From 62ea8286e6764f14c477cd2eae9157bd27543ae5 Mon Sep 17 00:00:00 2001 From: glorv Date: Tue, 24 Sep 2024 11:48:38 +0800 Subject: [PATCH 5/7] fix --- tikv-configuration-file.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index cab720ae8a9b1..960f3f81e1296 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -1990,7 +1990,7 @@ Configuration items related to Raft Engine. > 3. Enable Raft Engine by setting `enable` to `true` and restart TiKV to make the configuration take effect. + Specifies the version of log files in Raft Engine. -+ Value Options: ++ Value options: + `1`: Default log file version for TiKV earlier than v6.3.0. Can be read by TiKV >= v6.1.0. + `2`: Supports log recycling. Can be read by TiKV >= v6.3.0. + Default value: @@ -2430,7 +2430,7 @@ Configuration items related to resource control of the TiKV storage layer. Configure the control strategy for low priority tasks. TiKV ensures the priority execution of higher priority tasks by applying dynamic quota limit to low-priority tasks. This control strategy is used to calculates the quota for low priority tasks. -+ Value Options: ++ Value options: + `aggressive`: using this strategy, the flow control policy will prioritize the performance of high-priority tasks, ensuring that the throughput and latency of high-priority tasks are basically unaffected, but low-priority tasks will run slower. + `moderate`: using this strategy, TiKV will impose a balanced flow control limit on low-priority tasks, ensuring that low-priority tasks can use more system available resources while causing little impact on high-priority tasks. + `conservative`: using this strategy, the flow control policy will prioritize ensuring that system resources are fully utilized, and low-priority tasks will try to use available system resources as much as possible, resulting in a greater impact on the performance of high-priority tasks. From e686836bcd1748ae172784a9e711a14aac21e5bc Mon Sep 17 00:00:00 2001 From: glorv Date: Mon, 30 Sep 2024 15:30:18 +0800 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Grace Cai --- dynamic-config.md | 2 +- tidb-resource-control.md | 4 ++-- tikv-configuration-file.md | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dynamic-config.md b/dynamic-config.md index 266366b9a587c..8d2b1718bf656 100644 --- a/dynamic-config.md +++ b/dynamic-config.md @@ -169,7 +169,7 @@ The following TiKV configuration items can be modified dynamically: | `readpool.unified.max-thread-count` | The maximum number of threads in the thread pool that uniformly processes read requests, which is the size of the UnifyReadPool thread pool | | `readpool.unified.max-tasks-per-worker` | The maximum number of tasks allowed for a single thread in the unified read pool. `Server Is Busy` error is returned when the value is exceeded. | | `readpool.unified.auto-adjust-pool-size` | Determines whether to automatically adjust the UnifyReadPool thread pool size | -| `resource-control.priority-ctl-strategy` | Configures the control strategy of low-priority tasks. | +| `resource-control.priority-ctl-strategy` | Configures the flow control strategy of low-priority tasks. | | `coprocessor.split-region-on-table` | Enables to split Region by table | | `coprocessor.batch-split-limit` | The threshold of Region split in batches | | `coprocessor.region-max-size` | The maximum size of a Region | diff --git a/tidb-resource-control.md b/tidb-resource-control.md index 8e630eb2f9084..a3d75d7b1bfbd 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -413,7 +413,7 @@ Starting from v7.4.0, the TiDB resource control feature supports managing backgr #### `BACKGROUND` parameters - `TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. -- `UTILIZATION_LIMIT`: specifies the maximum resource percentage (0-100) of each TiKV instance that background tasks can consume. By default, the resource granted for background tasks are calculated based on the total resource quota and the current foreground workload dynamically. If `UTILIZATION_LIMIT` is configured, the resource granted for background tasks will not exceed this limit. +- `UTILIZATION_LIMIT`: limits the maximum percentage (0-100) of resources that background tasks can consume on each TiKV node. By default, TiKV calculates the available resources for background tasks based on the total resources of the node and the resources currently occupied by the foreground tasks. If `UTILIZATION_LIMIT` is configured, the resource allocated to background tasks will not exceed this limit. TiDB supports the following types of background tasks: @@ -445,7 +445,7 @@ By default, the task types that are marked as background tasks are `""`, and the #### Examples -1. Modify the `default` resource group and mark `br` and `ddl` as background tasks, and set background tasks resource limit to 30%. +1. Modify the `default` resource group by marking `br` and `ddl` as background tasks and setting the resource limit of background tasks to 30%. ```sql ALTER RESOURCE GROUP `default` BACKGROUND=(TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30); diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index 6e6169cf185cb..1029eaf8a1c0e 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -2428,12 +2428,12 @@ Configuration items related to resource control of the TiKV storage layer. ### `priority-ctl-strategy` New in v8.4.0 -Configure the control strategy for low priority tasks. TiKV ensures the priority execution of higher priority tasks by applying dynamic quota limit to low-priority tasks. This control strategy is used to calculates the quota for low priority tasks. +Specifies the flow control strategy for low-priority tasks. TiKV ensures that higher priority tasks are prioritized for execution by applying flow control to low-priority tasks. + Value options: - + `aggressive`: using this strategy, the flow control policy will prioritize the performance of high-priority tasks, ensuring that the throughput and latency of high-priority tasks are basically unaffected, but low-priority tasks will run slower. - + `moderate`: using this strategy, TiKV will impose a balanced flow control limit on low-priority tasks, ensuring that low-priority tasks can use more system available resources while causing little impact on high-priority tasks. - + `conservative`: using this strategy, the flow control policy will prioritize ensuring that system resources are fully utilized, and low-priority tasks will try to use available system resources as much as possible, resulting in a greater impact on the performance of high-priority tasks. + + `aggressive`: this policy prioritizes the performance of high-priority tasks, ensuring that the throughput and latency of high-priority tasks are largely unaffected, but low-priority tasks will run slower. + + `moderate`: this policy imposes a balanced flow control on low-priority tasks and has a lower impact on high-priority tasks. + + `conservative`: this policy prioritizes ensuring that system resources are fully utilized, allowing low-priority tasks to fully utilize system available resources as needed, and therefore has a greater performance impact on high-priority tasks. + Default value: `moderate`. ## split From 5dd5137a54e78e16e48c8e34360dda5079e643a2 Mon Sep 17 00:00:00 2001 From: glorv Date: Mon, 30 Sep 2024 15:30:43 +0800 Subject: [PATCH 7/7] Update tidb-resource-control.md --- tidb-resource-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-resource-control.md b/tidb-resource-control.md index a3d75d7b1bfbd..d83b4e2e5e13d 100644 --- a/tidb-resource-control.md +++ b/tidb-resource-control.md @@ -413,7 +413,7 @@ Starting from v7.4.0, the TiDB resource control feature supports managing backgr #### `BACKGROUND` parameters - `TASK_TYPES`: specifies the task types that need to be managed as background tasks. Use commas (`,`) to separate multiple task types. -- `UTILIZATION_LIMIT`: limits the maximum percentage (0-100) of resources that background tasks can consume on each TiKV node. By default, TiKV calculates the available resources for background tasks based on the total resources of the node and the resources currently occupied by the foreground tasks. If `UTILIZATION_LIMIT` is configured, the resource allocated to background tasks will not exceed this limit. +- `UTILIZATION_LIMIT`: limits the maximum percentage (0-100) of resources that background tasks can consume on each TiKV node. By default, TiKV calculates the available resources for background tasks based on the total resources of the node and the resources currently occupied by the foreground tasks. If `UTILIZATION_LIMIT` is configured, the resource allocated to background tasks will not exceed this limit. TiDB supports the following types of background tasks: