SQL Throttling
To ensure stability of core services, DAS throttles SQL statements based on specified rules when they cannot be tuned in a timely manner or when resource (for example, CPU) usage reaches 100%.
Usage Notes
- After SQL Throttling is enabled, TaurusDB instances can keep stable regardless of how many SQL statements are concurrently submitted.
- The following TaurusDB kernel versions are supported:
- 2.0.28.15 and later and earlier than 2.0.28.40
- 2.0.29.1 and later
- INSERT in 2.0.54.240600 and later
- A single throttling rule can contain a maximum of 128 keywords. Backslashes (\) or null characters (' ') cannot be used as keywords.
- Spaces at the beginning and end of a keyword and special null characters (such as \'t', \'r', and \'n') will be ignored.
- A throttling rule cannot end with a tilde (~).
- Keywords of a throttling rule are sorted in a specific order, and the system will match them from first to last. If a rule contains a~and~b, the system only matches xxx a>1 and b>2.
- If a SQL statement matches multiple throttling rules, only the latest rule is applied.
- Each SQL throttling rule is applied to only the SQL statements that your database received after the rule is created.
- If different rules are created for the primary node and read replicas of an instance, the rules still apply to the node and read replicas after their roles are switched over.
- The length of all rules and concurrent queries of a single SQL type (SELECT, UPDATE, DELETE, or INSERT) cannot exceed 4,000 bytes. The length of a single rule cannot exceed 1,000 bytes.
- If there are too many throttling rules, performance of SELECT, UPDATE, DELETE, and INSERT statements will deteriorate.
- Throttling rules are applied based on SQL statement prefixes. For example, if a throttling rule is SELECT~COUNT~t1, SELECT COUNT(*) FROM t1 and SELECT COUNT(*) FROM t1 LIMIT 1 will both be intercepted.
- If SQL throttling is triggered, error "ERROR 1317 (70100): Query execution was interrupted" is reported.
- SQL throttling is invalid for:
- System tables
- SQL statements not used to query data, for example, SELECT SLEEP(xxx)
- The root account for kernel versions earlier than 2.0.45.230900
- SQL statements stored in the query cache
Procedure
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner, and under Databases, click Data Admin Service. - In the navigation pane, choose Intelligent O&M > Instance List.
Alternatively, on the Overview page, click Go to Intelligent O&M.
- In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
- Locate the target instance and click Details.
- Click the SQL tab and then SQL Throttling.
- On the displayed page, toggle on Enable SQL Throttling.
Figure 1 Enabling SQL throttling
- Click Add Rule. In the displayed dialog box, specify SQL Type, Keyword, and Max. Concurrent Requests.
Figure 2 Add Rule
- Keyword: You can enter keywords or copy an existing SQL statement to the text box and click Generate Keyword.
Keywords generated from an original SQL statement are only for reference.
The following explains how a rule matches SQL statements based on keywords:
You can enter one or more keywords. Separate keywords with tildes (~). For example, if you enter keyword SELECT~a>1, this rule applies only to the SQL statements that contain SELECT and a>1, with SELECT placed before a>1.
- Max. Concurrent Requests indicates the maximum number of concurrent statements that meet the same rule. If the number of concurrent statements exceeds this value, they will be rejected.
- Keyword: You can enter keywords or copy an existing SQL statement to the text box and click Generate Keyword.
- Confirm the settings and click OK.
If a SQL throttling rule is no longer needed, click Delete in the Operation column.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot