-
Notifications
You must be signed in to change notification settings - Fork 701
resource control: support more mode for BURSTABLE #21138
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -33,7 +33,9 @@ DirectResourceGroupOption ::= | |
"RU_PER_SEC" EqOpt LengthNum | ||
| "PRIORITY" EqOpt ResourceGroupPriorityOption | ||
| "BURSTABLE" | ||
| "BURSTABLE" EqOpt Boolean | ||
| "BURSTABLE" EqOpt "MODERATED" | ||
| "BURSTABLE" EqOpt "UNLIMITED" | ||
| "BURSTABLE" EqOpt "OFF" | ||
| "QUERY_LIMIT" EqOpt '(' ResourceGroupRunawayOptionList ')' | ||
| "QUERY_LIMIT" EqOpt '(' ')' | ||
| "QUERY_LIMIT" EqOpt "NULL" | ||
|
@@ -84,7 +86,7 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | |
|---------------|-------------------------------------|------------------------| | ||
| `RU_PER_SEC` | Rate of RU backfilling per second | `RU_PER_SEC = 500` indicates that this resource group is backfilled with 500 RUs per second | | ||
| `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. | | ||
| `BURSTABLE` | TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. There are three modes, `OFF`, which means this resource group is not allowed to overuse the remaining system resources; `MODERATED`, which means this resource group is allowed to overuse the remaining system resources in a limited way; and `UNLIMITED`, which means this resource group is allowed to overuse the remaining system resources in an unlimited way. If no target value is specified for `BURSTABLE`, `MODERATED` is enabled by default. | | ||
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. Similar to the comment in For example:
Style Guide ReferencesFootnotes |
||
| `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-runaway-queries.md). | | ||
| `BACKGROUND` | Configure the background tasks. For more details, see [Manage background tasks](/tidb-resource-control-background-tasks.md). | `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. | | ||
|
||
|
@@ -168,11 +170,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', UTILIZATION_LIMIT=30 | | ||
+---------+------------+----------+-----------+-------------+-------------------------------------------+ | ||
+---------+------------+----------+----------------------+-------------+-------------------------------------------+ | ||
| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | BACKGROUND | | ||
+---------+------------+----------+----------------------+-------------+-------------------------------------------+ | ||
| default | UNLIMITED | MEDIUM | YES(UNLIMITED) | NULL | TASK_TYPES='br,ddl', UTILIZATION_LIMIT=30 | | ||
+---------+------------+----------+----------------------+-------------+-------------------------------------------+ | ||
1 rows in set (1.30 sec) | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -33,7 +33,9 @@ DirectResourceGroupOption ::= | |||||
"RU_PER_SEC" EqOpt stringLit | ||||||
| "PRIORITY" EqOpt ResourceGroupPriorityOption | ||||||
| "BURSTABLE" | ||||||
| "BURSTABLE" EqOpt Boolean | ||||||
| "BURSTABLE" EqOpt "MODERATED" | ||||||
| "BURSTABLE" EqOpt "UNLIMITED" | ||||||
| "BURSTABLE" EqOpt "OFF" | ||||||
| "QUERY_LIMIT" EqOpt '(' ResourceGroupRunawayOptionList ')' | ||||||
| "QUERY_LIMIT" EqOpt '(' ')' | ||||||
| "QUERY_LIMIT" EqOpt "NULL" | ||||||
|
@@ -81,13 +83,13 @@ TiDB supports the following `DirectResourceGroupOption`, where [Request Unit (RU | |||||
|---------------|-------------------------------------|------------------------| | ||||||
| `RU_PER_SEC` | Rate of RU backfilling per second | `RU_PER_SEC = 500` indicates that this resource group is backfilled with 500 RUs per second | | ||||||
| `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. | | ||||||
| `BURSTABLE` | TiDB allows the corresponding resource group to use the available system resources when the quota is exceeded. There are three modes, `OFF`, which means this resource group is not allowed to overuse the remaining system resources; `MODERATED`, which means this resource group is allowed to overuse the remaining system resources in a limited way; and `UNLIMITED`, which means this resource group is allowed to overuse the remaining system resources in an unlimited way. If no target value is specified for `BURSTABLE`, `MODERATED` is enabled by default. | | ||||||
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. |
||||||
| `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-runaway-queries.md). | | ||||||
|
||||||
> **Note:** | ||||||
> | ||||||
> - The `CREATE RESOURCE GROUP` statement can only be executed when the global variable [`tidb_enable_resource_control`](/system-variables.md#tidb_enable_resource_control-new-in-v660) is set to `ON`. | ||||||
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and it is in `BURSTABLE` mode. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. | ||||||
> TiDB automatically creates a `default` resource group during cluster initialization. For this resource group, the default value of `RU_PER_SEC` is `UNLIMITED` (equivalent to the maximum value of the `INT` type, that is, `2147483647`) and its `BURSTABLE` mode is `UNLIMTED`. All requests that are not bound to any resource group are automatically bound to this `default` resource group. When you create a new configuration for another resource group, it is recommended to modify the `default` resource group configuration as needed. | ||||||
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's a typo here: "UNLIMTED" should be "UNLIMITED". 1 Style Guide References
Suggested change
Footnotes |
||||||
> - Currently, only the `default` resource group supports modifying the `BACKGROUND` configuration. | ||||||
|
||||||
## Examples | ||||||
|
@@ -127,12 +129,12 @@ SELECT * FROM information_schema.resource_groups WHERE NAME ='rg1' or NAME = 'rg | |||||
``` | ||||||
|
||||||
```sql | ||||||
+------+------------+----------+-----------+---------------------------------+ | ||||||
| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | | ||||||
+------+------------+----------+-----------+---------------------------------+ | ||||||
| rg1 | 100 | HIGH | YES | NULL | | ||||||
| rg2 | 200 | MEDIUM | NO | EXEC_ELAPSED=100ms, ACTION=KILL | | ||||||
+------+------------+----------+-----------+---------------------------------+ | ||||||
+------+------------+----------+----------------------+---------------------------------+ | ||||||
| NAME | RU_PER_SEC | PRIORITY | BURSTABLE | QUERY_LIMIT | | ||||||
+------+------------+----------+----------------------+---------------------------------+ | ||||||
| rg1 | 100 | HIGH | YES(MODERATED) | NULL | | ||||||
| rg2 | 200 | MEDIUM | NO | EXEC_ELAPSED=100ms, ACTION=KILL | | ||||||
+------+------------+----------+----------------------+---------------------------------+ | ||||||
2 rows in set (1.30 sec) | ||||||
``` | ||||||
|
||||||
|
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.
The description for
BURSTABLE
is quite long. For better readability 1, consider breaking it down. For example:"*
BURSTABLE
: Specifies whether the resource group can overuse available system resources. It supports three modes:*
OFF
: The resource group cannot overuse remaining system resources.*
MODERATED
: The resource group can overuse remaining system resources in a limited way. This is the default mode ifBURSTABLE
is specified without a value.*
UNLIMITED
: The resource group can overuse remaining system resources in an unlimited way."Style Guide References
Footnotes
Ensuring documentation is clear and readable is a key review aspect. (link) ↩