Configures parameters related to automatic SQL throttling for specified database instances at a time in an asynchronous manner.

Note The complete query results are not returned immediately after an asynchronous call is made. If the value of isFinish is false in the response, wait for 1 second and then re-initiate the call. The complete query results are returned until the value of isFinish is true.

Before you call this operation, make sure that the following requirements are met:

  • The region is set to cn-shanghai when you use an SDK to call Database Autonomy Service (DAS).
  • The Enable Autonomy Service switch is turned on for the database instance. For more information, see Autonomy center.
  • The database instance that you want to manage is of one of the following types:
    • An ApsaraDB RDS for MySQL instance of the High-availability Edition or the Enterprise Edition that runs MySQL 5.6, MySQL 5.7, or MySQL 8.0
    • A PolarDB for MySQL cluster of the Cluster Edition that runs MySQL 5.6, MySQL 5.7, or MySQL 8.0 or a PolarDB for MySQL cluster of the X-Engine that runs MySQL 8.0

Request parameters

Parameter Type Required Example Description
Action String Yes UpdateAutoThrottleRulesAsync

The operation that you want to perform. Set the value to UpdateAutoThrottleRulesAsync.

ConsoleContext String No None

A reserved parameter.

InstanceIds String Yes ['rm-2ze8g2am97624****','rm-2ze9xrhze0709****']

The ID of the database instance.

Note Specify the value of this parameter in the JSONArray format. Separate instance IDs with commas (,). Example: ['Instance ID1','Instance ID2'].
CpuUsage double No 70

The CPU utilization threshold. Valid values: 70% to 100%.

CpuSessionRelation String Yes OR

The logical relationship between the CPU utilization threshold and the maximum number of active sessions. Valid values:

  • AND
  • OR
ActiveSessions Long No 16

The maximum number of active sessions.

  • Specify an integer that is greater than or equal to 16 when the CPU utilization threshold and the maximum number of active sessions are in the OR relationship.
  • Specify an integer that is greater than or equal to 2 when the CPU utilization threshold and the maximum number of active sessions are in the AND relationship.
AbnormalDuration double No 2

The maximum period of time during which an exception occurs when automatic SQL throttling is triggered. Set this parameter to a positive integer that is greater than or equal to 2. Unit: minutes.

MaxThrottleTime double No 10

The maximum throttling duration. Set this parameter to a positive number. Unit: minutes.

AllowThrottleStartTime String Yes 00:00Z

The start time of the throttling period. Specify this parameter in UTC.

AllowThrottleEndTime String Yes 23:59Z

The end time of the throttling period. Specify this parameter in UTC.

AutoKillSession Boolean No true

Specifies whether to terminate abnormal SQL statements in execution at the same time. Valid values:

Note Abnormal SQL statements use the same template as the SQL statements that need to be throttled.
  • true
  • false
ResultId String No async__507044db6c4eadfa2dab9b084e80****

The ID of the asynchronous request.

Note You do not need to specify this parameter when you call this operation to send a request for the first time. In subsequent requests sent by calling this operation, set this parameter to the value of this parameter returned in the response to the first request.

Response parameters

Parameter Type Example Description
Code Long 200

The returned HTTP status code.

Message String Successful

The message that is returned for the request.

Note If the request is successful, Successful is returned. If the request fails, an error message that contains information such as an error code is returned.
Data Object

The returned data.

Fail Boolean false

Indicates whether the asynchronous request failed. Valid values:

  • true: The asynchronous request failed.
  • false: The asynchronous request is successful.
ConfigResponse Object

The returned data that is configured concurrently.

Note This data is returned only when isFinish is set to true.
TotalInstanceCount Long 2

The total number of database instances.

ConfigSuccessInstanceCount Long 1

The number of database instances for which the specified parameters are configured.

ConfigFailInstanceCount Long 1

The number of database instances for which the specified parameters failed to be configured.

ConfigSuccessInstanceList Array of configSuccessInstanceList

The list of database instances for which the specified parameters are configured.

ConfigSuccess Boolean true

Indicates whether the specified parameters are configured. Valid values:

  • true
  • false
InstanceId String rm-2ze8g2am97624****

The ID of the database instance.

ConfigFailInstanceList Array of configFailInstanceList

The list of database instances for which the specified parameters failed to be configured.

ConfigSuccess Boolean false

Indicates whether the specified parameters are configured. Valid values:

  • true
  • false
InstanceId String rm-2ze9xrhze0709****

The ID of the database instance.

ErrorMessage String instance das autonomy service is off or can not find instance

The error message.

ResultId String async__665ee69612f1627c7fd9f3c85075****

The ID of the asynchronous request.

IsFinish Boolean true

Indicates whether the asynchronous request is completed. Valid values:

  • true
  • false
State String SUCCESS

The state of the asynchronous request. Valid values:

  • RUNNING
  • SUCCESS
  • FAIL
Complete Boolean true

Indicates whether the asynchronous request is complete. Valid values:

  • true
  • false
Timestamp Long 1645668213000

The time when the asynchronous request was made. The value of this parameter is a UNIX timestamp. Unit: milliseconds.

RequestId String B6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

Success Boolean true

Indicates whether the request is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=UpdateAutoThrottleRulesAsync
&InstanceIds=['rm-2ze8g2am97624****','rm-2ze9xrhze0709****']
&CpuUsage=70.0
&CpuSessionRelation=OR
&ActiveSessions=16
&AbnormalDuration=2.0
&MaxThrottleTime=10.0
&AllowThrottleStartTime=00:00Z
&AllowThrottleEndTime=23:59Z
&AutoKillSession=true
&ResultId=async__507044db6c4eadfa2dab9b084e80****
&<Common request parameters>

Sample success response

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateAutoThrottleRulesAsyncResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <Data>
        <Fail>false</Fail>
        <ConfigResponse>
            <TotalInstanceCount>2</TotalInstanceCount>
            <ConfigSuccessInstanceCount>1</ConfigSuccessInstanceCount>
            <ConfigFailInstanceCount>1</ConfigFailInstanceCount>
            <ConfigSuccessInstanceList>
                <ConfigSuccess>true</ConfigSuccess>
                <InstanceId>rm-2ze8g2am97624****</InstanceId>
            </ConfigSuccessInstanceList>
            <ConfigFailInstanceList>
                <ConfigSuccess>false</ConfigSuccess>
                <InstanceId>rm-2ze9xrhze0709****</InstanceId>
                <ErrorMessage>instance das autonomy service is off or can not find instance</ErrorMessage>
            </ConfigFailInstanceList>
        </ConfigResponse>
        <ResultId>async__665ee69612f1627c7fd9f3c85075****</ResultId>
        <IsFinish>true</IsFinish>
        <State>SUCCESS</State>
        <Complete>true</Complete>
        <Timestamp>1645668213000</Timestamp>
    </Data>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Success>true</Success>
</UpdateAutoThrottleRulesAsyncResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Code" : 200,
  "Message" : "Successful",
  "Data" : {
    "Fail" : false,
    "ConfigResponse" : {
      "TotalInstanceCount" : 2,
      "ConfigSuccessInstanceCount" : 1,
      "ConfigFailInstanceCount" : 1,
      "ConfigSuccessInstanceList" : [ {
        "ConfigSuccess" : true,
        "InstanceId" : "rm-2ze8g2am97624****"
      } ],
      "ConfigFailInstanceList" : [ {
        "ConfigSuccess" : false,
        "InstanceId" : "rm-2ze9xrhze0709****",
        "ErrorMessage" : "instance das autonomy service is off or can not find instance"
      } ]
    },
    "ResultId" : "async__665ee69612f1627c7fd9f3c85075****",
    "IsFinish" : true,
    "State" : "SUCCESS",
    "Complete" : true,
    "Timestamp" : 1645668213000
  },
  "RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success" : true
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParams The request parameters are invalid. The error message returned because the specified request parameters are invalid.

For a list of error codes, visit the API Error Center.