Creates stress testing tasks.

Database Autonomy Service (DAS) provides the intelligent stress testing feature. This feature helps you check whether your instance needs to be scaled up to handle traffic spikes in an effective manner. For more information, see Intelligent stress testing. Before you call this API operation, make sure that your database instances meet the following requirements:

  • The source instance is one of the following instances: an ApsaraDB RDS for MySQL High-availability Edition instance, an ApsaraDB RDS for MySQL Enterprise Edition instance, a PolarDB for MySQL Cluster Edition instance, and a PolarDB for MySQL X-Engine instance.
  • The destination instance is an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance.
  • The source instance and the destination instance are connected to DAS. For information about how to connect database instances to DAS, see Connect an Alibaba Cloud database instance to DAS.
  • DAS Professional Edition is enabled for the source instance and the destination instance. For more information, see Usage notes on DAS Professional Edition.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateCloudBenchTasks

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

TaskTypeStringYespressure test

The type of the stress testing task. Default value: pressure test. Valid values:

  • pressure test: A task of this type replays the traffic that is captured from the source instance on the destination instance at the maximum playback rate that is supported by the destination instance.
  • smart pressure test: A task of this type analyzes the traffic that is captured from the source instance over a short period of time and generates traffic on the destination instance for continuous stress testing. The business model based on which the traffic is generated on the destination instance and the traffic distribution are consistent with those on the source instance. Stress testing tasks of this type can help you reduce the amount of time that is consumed to collect data from the source instance and reduce storage costs and performance overheads.
SrcInstanceIdStringYesrm-2ze1jdv45i7l6****

The ID of the source instance. The instance must be an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance. You can call the GetInstanceInspections operation to query the ID.

Note If you set DstType to Instance, you must specify this parameter.
DescriptionStringYestest-das-bench-0501

The description of the stress testing task.

SrcPublicIpStringNoNone

A hidden parameter.

DstInstanceIdStringNorm-2ze1jdv45i7l6****

The ID of the destination instance. The instance must be an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance. You can call the GetInstanceInspections operation to query the ID.

Note If you set DstType to Instance, you must specify this parameter.
GatewayVpcIdStringNovpc-t4nsnwvpbc1h76ja4****

The ID of the virtual private cloud (VPC) in which the database gateway (DBGateway) is deployed.

Note If you set ClientType to ECS, you must specify this parameter.
GatewayVpcIpStringNo172.30.XX.XX

The IP address or domain name of the DBGateway.

Note If you set ClientType to ECS, you must specify this parameter.
ClientTypeStringYesECS

The type of the stress testing client. Valid values:

  • ECS: indicates that you must create the DBGateway.
  • DAS_ECS: indicates that DAS automatically purchases and deploys an Elastic Compute Service (ECS) instance for stress testing.
RequestStartTimeStringNo1608888296000

The start time of the stress testing task. Specify the time in the UNIX timestamp format. Unit: milliseconds.

RequestEndTimeStringNo1608888296001

The end time of the stress testing task. Specify the time in the UNIX timestamp format. Unit: milliseconds.

RequestDurationStringNo86400000

The duration of the stress testing task for which the traffic is captured from the source instance. Unit: milliseconds.

RateStringNo1

The rate at which the traffic captured from the source instance is replayed on the destination instance. The value must be a positive integer. Valid values: 1 to 30. Default value: 1.

SmartPressureTimeStringNo86400000

The duration of the stress testing task for which the traffic is generated on the destination instance. Unit: milliseconds.

Note If you set TaskType to smart pressure test, you must specify this parameter.
DtsJobClassStringNomedium

The specification of the Data Transmission Service (DTS) migration task. You can call the DescribeCloudbenchTask operation to query the specification.

Note You must migrate the basic data in the source instance to the destination instance before you start a stress testing task. When you create a DTS migration task, you must specify this parameter.
DtsJobIdStringNo23127

The ID of the DTS migration task. You can call the ConfigureDtsJob operation to query the ID.

Note After a DTS migration task is created in the DTS console, you must specify this parameter.
SrcSuperAccountStringNoadmin

The name of the privileged account for the source instance. Set the value to admin.

Note If you set DstType to Instance, you must specify this parameter.
SrcSuperPasswordStringNotest123

The password of the privileged account for the source instance.

Note If you set DstType to Instance, you must specify this parameter.
DstSuperAccountStringNoroot

The name of the privileged account for the destination instance.

DstSuperPasswordStringNotest123

The password of the privileged account for the destination instance.

DstTypeStringNoInstance

The type of the identifier that is used to indicate the destination instance. Default value: Instance. Valid values:

  • Instance: the ID of the instance.
  • ConnectionString: the endpoint of the instance.
DstConnectionStringStringNorm-de21209****.mysql.rds.aliyuncs.com

The endpoint of the destination instance. The specified endpoint must be the endpoint of an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance.

Note This parameter takes effect only when the DstType parameter is set to ConnectionString.
DstPortStringNo3306

The port number of the destination instance.

Note This parameter takes effect only when the DstType parameter is set to ConnectionString.
WorkDirStringNo/tmp/bench/

The temporary directory generated for stress testing.

BackupIdStringNo229132

The ID of the backup set. You can call the DescribeBackups operation to query the ID.

BackupTimeStringNo2021-04-23T13:22:14Z

The time when the backup starts. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

AmountStringNo1

The total number of stress testing tasks that you want to create. Valid values: 0 to 30. Default value: 1.

EndStateStringNoWAIT_TARGET

The state that specifies the last operation that is performed for the stress testing task. Valid values:

  • WAIT_TARGET: prepares the destination instance
  • WAIT_DBGATEWAY: prepares the DBGateway
  • WAIT_SQL: prepares the full SQL statistics
  • WAIT_LOGIC: prepares to replay the traffic
Note When the state of a stress testing task changes to the state that is specified by the EndState parameter, the stress testing task becomes completed.

Response parameters

ParameterTypeExampleDescription
CodeString200

The returned status code.

MessageStringSuccessful

The returned message for the request.

Note If the request is successful, Successful is returned. If the request fails, an error message that includes an error code is returned.
RequestIdStringB6D17591-B48B-4D31-9CD6-9B9796B2****

The ID of the request.

SuccessStringtrue

Indicates whether the request is successful. Valid values:

  • true
  • false
DataArray of String"Data": { "total": 1, "list":[...] }, "Code": 200, "Success": true }

The detailed information, such as the HTTP status code and the number of returned entries.

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=CreateCloudBenchTasks
&TaskType=pressure test
&SrcInstanceId=rm-2ze1jdv45i7l6****
&Description=test-das-bench-0501
&SrcPublicIp=None
&DstInstanceId=rm-2ze1jdv45i7l6****
&GatewayVpcId=vpc-t4nsnwvpbc1h76ja4****
&GatewayVpcIp=172.30.XX.XX
&ClientType=ECS
&RequestStartTime=1608888296000
&RequestEndTime=1608888296001
&RequestDuration=86400000
&Rate=1
&SmartPressureTime=86400000
&DtsJobClass=medium
&DtsJobId=23127
&SrcSuperAccount=admin
&SrcSuperPassword=test123
&DstSuperAccount=root
&DstSuperPassword=test123
&DstType=Instance
&DstConnectionString=rm-de21209****.mysql.rds.aliyuncs.com
&DstPort=3306
&WorkDir=/tmp/bench/
&BackupId=229132
&BackupTime=2021-04-23T13:22:14Z
&Amount=1
&EndState=WAIT_TARGET
&<Common request parameters>

Sample success responses

XML format

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

<CreateCloudBenchTasksResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
    <Success>true</Success>
    <Data>"Data": { "total": 1, "list":[...] }, "Code": 200, "Success": true }</Data>
</CreateCloudBenchTasksResponse>

JSON format

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

{
  "Code" : "200",
  "Message" : "Successful",
  "RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success" : "true",
  "Data" : [ "\"Data\": { \"total\": 1, \"list\":[...] }, \"Code\": 200, \"Success\": true }" ]
}

Errors codes

HTTP status codeError codeError messageDescription
400InvalidParamsThe 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.