All Products
Search
Document Center

Database Autonomy Service:CreateCloudBenchTasks

Last Updated:Mar 22, 2024

Creates stress testing tasks.

Operation description

Database Autonomy Service (DAS) provides the intelligent stress testing feature. This feature helps you check whether your instance needs to be scaled up to effectively handle traffic spikes. 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 database instance is an ApsaraDB RDS for MySQL High-availability Edition or Enterprise Edition instance, or a PolarDB for MySQL Cluster Edition or X-Engine Edition cluster.
  • The destination database instance is an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL instance.
  • The source and destination database instances are connected to DAS. For information about how to connect database instances to DAS, see Connect an Alibaba Cloud database instance to DAS.
  • DAS Enterprise Edition is enabled for the source and destination database instances. For more information, see Overview .

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:CreateCloudBenchTasksWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TaskTypestringYes

The type of the stress testing task. Valid values:

  • pressure test (default): 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.
pressure test
SrcInstanceIdstringYes

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 This parameter must be specified if you set DstType to Instance.
rm-2ze1jdv45i7l6****
DescriptionstringYes

The description of the stress testing task.

test-das-bench-0501
SrcPublicIpstringNo

The reserved parameter.

None
DstInstanceIdstringNo

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 This parameter must be specified if you set DstType to Instance.
rm-2ze1jdv45i7l6****
GatewayVpcIdstringNo

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

Note This parameter must be specified if you set ClientType to ECS.
vpc-t4nsnwvpbc1h76ja4****
GatewayVpcIpstringNo

The IP address or domain name of the DBGateway.

Note This parameter must be specified if you set ClientType to ECS.
172.30.XX.XX
ClientTypestringYes

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.
ECS
RequestStartTimestringNo

The time when the stress testing task starts. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1608888296000
RequestEndTimestringNo

The time when the stress testing task ends. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1608888296001
RequestDurationstringNo

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

86400000
RatestringNo

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.

1
SmartPressureTimestringNo

The duration within which the traffic generation stressing test takes effect. Unit: milliseconds.

Note This parameter must be specified if you set TaskType to smart pressure test.
86400000
DtsJobClassstringNo

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.
medium
DtsJobIdstringNo

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.
23127
SrcSuperAccountstringNo

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

Note This parameter must be specified if you set DstType to Instance.
admin
SrcSuperPasswordstringNo

The password of the privileged account for the source instance.

Note This parameter must be specified if you set DstType to Instance.
test123
DstSuperAccountstringNo

The name of the privileged account for the destination instance.

root
DstSuperPasswordstringNo

The password of the privileged account for the destination instance.

test123
DstTypestringNo

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

  • Instance: the instance ID. This is the default value.
  • ConnectionString: the endpoint of the instance.
Instance
DstConnectionStringstringNo

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 if you set DstType to ConnectionString.
rm-de21209****.mysql.rds.aliyuncs.com
DstPortstringNo

The port number of the instance that you want to access.

Note This parameter takes effect only if you set DstType to ConnectionString.
3306
WorkDirstringNo

The temporary directory generated for stress testing.

/tmp/bench/
BackupIdstringNo

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

229132
BackupTimestringNo

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.

2021-04-23T13:22:14Z
AmountstringNo

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

1
EndStatestringNo

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.
WAIT_TARGET

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code returned.

200
Messagestring

The returned message.

Note If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned.
Successful
RequestIdstring

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****
Successstring

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
true
Dataarray

The detailed information.

string

The detailed information, including the error codes and the number of entries that are returned.

"Data": { "total": 1, "list":[...] }, "Code": 200, "Success": true }

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history