DAS provides the SQL throttling feature. You can use SQL throttling to control the amount of database access requests and concurrent SQL statements to ensure service availability. This topic describes how to use SQL throttling. The SQL throttling feature for ApsaraDB RDS for MySQL is described in this topic.
Most applications are dependent on databases. To alleviate pressure on databases, you can perform throttling operations at the application side. However, in the following scenarios, you must configure throttling at the database side.
|Sharp rise in concurrent SQL statements||Cache penetration or abnormal calls may result in unexpected rise in concurrent SQL statements.|
|SQL statements that result in data skew||If a large amount of data is queried during a sales promotion, the overall system is affected.|
|Tables that are not indexed||If a large number of SQL statements are executed on new database tables that are not indexed, the system slows down and normal services are affected.|
- Go to the Instance Sessions page. For more information, see Instance sessions.
- On the Instance Sessions page, click SQL Throttling.
- In the SQL Throttling dialog box, click Create.
- In the Configure SQL Throttling Rule dialog box, configure the parameters described in the following table. Then, click
Parameter Description SQL Type The type of the SQL statement. Valid values: SELECT, UPDATE, and DELETE. Max Concurrency The maximum number of concurrent SQL statements. The throttling rule is triggered when the number of SQL statements that contain a specific keyword reaches the value specified for this parameter. If this parameter is set to 0, all requests that contain the keyword are denied. Throttling Duration The duration within which the SQL throttling rule takes effect. SQL throttling is used only in emergencies. We recommend that you set the throttling duration based on your actual requirements and disable SQL throttling when it is no longer needed. SQL Keywords The SQL keyword that requires throttling. If you specify multiple keywords, SQL throttling is triggered only when the SQL statements contain all the specified keywords. Separate multiple keywords with tildes (~).Note After the SQL throttling rule is created, if the SQL statement submitted by a client contains all the specified keywords, the client receives error 1317. The error message is "query execution was interrupted".
- After the SQL throttling rule is created, you can view the status of the rule in the
SQL throttling list.Note If you want to modify an SQL throttling rule or disable it before the specified throttling duration expires, click Close or Edit in the Actions column.