Creates a stress testing task.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
eas:CreateBenchmarkTask | *BenchmarkTask acs:eas:{#regionId}:{#accountId}:benchmarktask/* |
| none |
Request syntax
POST /api/v2/benchmark-tasks HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
body | string | No | The request body. The body includes the parameters that are set to create a stress testing task. | { "base": { "duration": 600 }, "service": { "serviceName": "test_service", "requestToken": "test_token" }, "data": { "path": "https://larec-benchmark-cd.oss-cn-chengdu.aliyuncs.com/youbei/sv_dbmtl/data/youbei.warmup.tf.bin", "dataType": "binary" }, "optional": { "maxRt": 100 } } |
Parameters that are set to create a stress testing task
The following table describes the parameters that are set to create a stress testing task by using eas-benchmark.
Parameter | Description |
---|---|
base | The basic configurations of the stress testing task. |
service | The configurations related to the service that you want to test. |
data | The configurations related to the requested data for the stress testing. |
http | The configurations related to the request HTTP for the service. |
optional | The optional advanced configurations for the stress testing task. |
Table 1. Fields in the base parameter
Field | Description |
---|---|
name | The name of the stress testing task. If you do not specify this field, the task is automatically named based on the service name. This field is optional. |
duration | The total stress testing duration. Unit: seconds. Default value: 1200. This field is optional. |
qps | The expected queries per second (QPS) of the stress testing task. Default value: 10000. This field is optional. |
concurrency | The number of concurrent connections that you want to create for each instance in the stress testing task. The default value is 40, and it canbe automatically changed. This field is optional. |
agentCount | The number of instances that you want to create for the stress testing task. The default value is 1, and it can be automatically changed. This field is optional. |
Table 2. Fields in the service parameter
**Field** | **Description** |
---|---|
serviceUrl | The URL of the service that you want to test. If a service of Elastic Algorithm Service (EAS) is tested, this field can be ignored. This field is optional. |
serviceName | The name of the service that you want to test. If a service of EAS is tested, this field must be set. If a custom service is tested, this field can be ignored. This field is optional. |
requestToken | The token used to access the service. If the value of **serviceName** is specified, this field can be ignored. This field is optional. |
endpointType | The type of stress testing supported by the service. Valid values: default and direct. **default** specifies that the stress testing task is performed on the service by using a gateway. **direct** specifies that the stress testing task is directly performed on the service. Default value: **direct**. This field is optional. |
Table 3. Fields in the data parameter
**Field** | **Description** |
---|---|
content | The content of a stress testing request. The value of this field is of the STRING type. This field is optional. |
path | The path of the stress testing data. The path can be a single file or a `.zip` file. The `.zip` file is automatically downloaded and decompressed. This field is optional. |
dataType | The type of the test data. Valid values: text and binary. Default value: text. This field is optional. |
multiLine | Specifies whether to separate the stress testing data by line. Valid values: true and false. Default value: false. If you set this field to true, the downloaded data is parsed by line. This field is optional. |
Table 4. Fields in the HTTP parameter
**Field** | **Description** |
---|---|
method | The HTTP request method. Default value: POST. This field is optional. |
host | The host that sends the request. This field is empty by default. This field is optional. |
headers | The header of the HTTP request. The header is of the LIST type, such as `["Authorization:aaa", "Content-Type:text"] `. This field is optional. |
timeout | The HTTP request latency. Unit: millisecond. Default value: 20000. This field is optional. |
Table 5. Fields in the optional parameter
**Field** | **Description** |
---|---|
mode | The stress testing mode. Valid values: auto, scan, and manual. The value scan specifies to periodically perform stress testing. Default value: auto. This field is optional. |
adjustInterval | The interval at which stress testing is automatically performed. Unit: seconds. If this field is set to 1, stress testing is performed at an interval of 1 second. Default value: 60. This field is optional. |
minQPS | The minimum QPS of stress testing. Default value: 100. This field is optional. |
maxQPS | The maximum QPS of stress testing. Default value: 10000. This field is optional. |
maxRT | The maximum response time. If the actual response time exceeds the specified upper limit, the QPS is automatically adjusted until the response time drops below the upper limit. This field is optional. |
qpsGrowthDelta | The QPS increment. Default value: 50. This field is optional. |
faultTolerate | The highest request error rate that can be tolerated, excluding errors with the HTTP 200 status code. Default value: 0.001. This field is optional. |
faultAction | The operation that is performed if the request error rate exceeds the threshold specified by the faultTolerate field. Valid values: stop and revise. stop means to maintain the current QPS and stop increasing the loads. revise means to dynamically adjust the QPS until the request error rate meets the expectation. This field is optional. |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "40325405-579C-4D82********",
"TaskName": "benchmark-larec-test-1076",
"Region": "cn-shanghai",
"Message": "Benchmark task [foo] is Creating"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|
No change history