Feature description
The SQL throttling feature is suitable for scenarios involving high CPU utilization caused by high traffic. You can create SQL throttling tasks to control the database requests and SQL concurrency by setting the SQL Type, Max Concurrency, Throttling Duration, and SQL Keyword.
Note:
SQL throttling is supported only for TencentDB for MongoDB 4.0 and 7.0 versions.
If SQL throttling prevents a SQL statement from being executed, the error message SQL rejected by CDB_SQL_FILTER will be displayed.
Creating SQL Traffic Throttling
2. In the left sidebar, choose Performance Optimization.
3. Select MongoDB database type and instance ID at the top of the page, and select the Real-Time Sessions tab.
4. At the bottom of the page, you can select the SQL Throttling module.
5. Create traffic throttling tasks.
Note:
SQL traffic throttling requires database account authentication and authorization.
5.1 Click Log In, enter the database account and password, and click OK.
5.2 On the page, click Create Task, configure the following parameters, and click OK.
SQL Type: Select find, insert, update, or delete.
Max Concurrency: Set the maximum number of concurrent SQL executions. If the number of concurrent SQL executions containing specified keywords reaches this value, the SQL throttling policy will be triggered. If this value is set to 0, it restricts all matched SQL executions.
Execution Mode: Select Scheduled stop or Manual stop.
Throttling Duration: If you select Scheduled stop, you need to set how long the SQL throttling task runs.
SQL Keyword: Set the keywords. SQL statements containing the specified keywords will be restricted. Multiple keywords should be separated by comma and are evaluated by using the logical AND operator. Comma cannot be used as a keyword.
6. View the status and details of the SQL throttling task.
Click Details in the Operation column to view SQL throttling details.
After a SQL throttling task is enabled, it will remain in the Running status until its remaining time decreases to zero. You can click Disable in the Operation column to disable the task, and its status will change to Terminated.
After a SQL throttling task is enabled, its status will change to Terminated once its remaining time decreases to zero.
Click Delete in the Operation column to delete a SQL throttling task in the Terminated or Completed status.
Use case and effect of SQL throttling
The database traffic was too high, resulting in a high CPU utilization.
1. The MongoTop tab in the console shows that the traffic of the test.test11 table was too high. If the main business traffic was the read traffic to the test.test10 table, then the traffic to the test.test11 table was abnormal traffic.
2. SQL throttling was enabled to throttle the traffic to the test.test11 table.
3. As shown in the CPU performance trend chart below, CPU utilization dropped rapidly after throttling was enabled.