Creates a stress testing task.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
eas:CreateBenchmarkTask |
*BenchmarkTask
|
None | None |
Request syntax
POST /api/v2/benchmark-tasks HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
string |
No |
The request body that contains the configuration parameters for the 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 for creating a stress testing task with eas-benchmark.
| Parameter | Description |
| base | Basic configurations for the stress testing task. |
| service | Configuration for the service to test. |
| data | Configuration for the stress testing request data. |
| http | HTTP request configuration for the service. |
| optional | 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 not specified, the task is automatically named after the service. Optional. |
| duration | The stress testing duration. Unit: seconds. Default value: 1200. Optional. |
| qps | The expected queries per second (QPS). Default value: 10000. Optional. |
| concurrency | The number of concurrent connections per instance. Default value: 40. The value can be automatically adjusted. Optional. |
| agentCount | The number of instances for the stress testing task. Default value: 1. The value can be automatically adjusted. Optional. |
Table 2. Fields in the service parameter
| **Field** | **Description** |
| serviceUrl | The URL of the service to test. Not required for Elastic Algorithm Service (EAS) services. Optional. |
| serviceName | The name of the service to test. Required for EAS services. Not required for custom services. Optional. |
| requestToken | The token used to access the service. Not required if **serviceName** is specified. Optional. |
| endpointType | The stress testing type. Valid values: **default** (test through a gateway) and **direct** (test the service directly). Default value: **direct**. Optional. |
Table 3. Fields in the data parameter
| **Field** | **Description** |
| content | The content of a stress testing request. Value type: STRING. Optional. |
| path | The path of the stress testing data. Supports a single file or a `.zip` file, which is automatically downloaded and decompressed. Optional. |
| dataType | The test data type. Valid values: text and binary. Default value: text. Optional. |
| multiLine | Specifies whether to parse the stress testing data line by line. Valid values: true and false. Default value: false. Optional. |
Table 4. Fields in the HTTP parameter
| **Field** | **Description** |
| method | The HTTP request method. Default value: POST. Optional. |
| host | The request host. Empty by default. Optional. |
| headers | The HTTP request headers. Value type: LIST, for example, `["Authorization:aaa", "Content-Type:text"]`. Optional. |
| timeout | The HTTP request timeout. Unit: milliseconds. Default value: 20000. Optional. |
Table 5. Fields in the optional parameter
| **Field** | **Description** |
| mode | The stress testing mode. Valid values: auto, scan (periodically perform stress testing), and manual. Default value: auto. Optional. |
| adjustInterval | The interval at which stress testing is automatically performed. Unit: seconds. Default value: 60. Optional. |
| minQPS | The minimum QPS. Default value: 100. Optional. |
| maxQPS | The maximum QPS. Default value: 10000. Optional. |
| maxRT | The maximum response time. If the actual response time exceeds this limit, the QPS is automatically reduced until the response time drops below the limit. Optional. |
| qpsGrowthDelta | The QPS increment. Default value: 50. Optional. |
| faultTolerate | The maximum tolerable request error rate, excluding HTTP 200 errors. Default value: 0.001. Optional. |
| faultAction | The action to take when the error rate exceeds the faultTolerate threshold. Valid values: stop (maintain the current QPS) and revise (dynamically adjust the QPS until the error rate meets expectations). Optional. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
40325405-579C-4D82******** |
| TaskName |
string |
The name of the stress testing task. |
benchmark-larec-test-1076 |
| Region |
string |
The region ID where the stress testing task runs. |
cn-shanghai |
| Message |
string |
The returned message. |
Benchmark task [foo] is Creating |
Examples
Success response
JSON format
{
"RequestId": "40325405-579C-4D82********",
"TaskName": "benchmark-larec-test-1076",
"Region": "cn-shanghai",
"Message": "Benchmark task [foo] is Creating"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.