All Products
Search
Document Center

Platform For AI:CreateBenchmarkTask

Last Updated:Nov 22, 2024

Creates a stress testing task.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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
eas:CreateBenchmarkTask
*BenchmarkTask
acs:eas:{#regionId}:{#accountId}:benchmarktask/*
    none
none

Request syntax

POST /api/v2/benchmark-tasks HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
bodystringNo

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.

ParameterDescription
baseThe basic configurations of the stress testing task.
serviceThe configurations related to the service that you want to test.
dataThe configurations related to the requested data for the stress testing.
httpThe configurations related to the request HTTP for the service.
optionalThe optional advanced configurations for the stress testing task.

Table 1. Fields in the base parameter

FieldDescription
nameThe 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.
durationThe total stress testing duration. Unit: seconds. Default value: 1200. This field is optional.
qpsThe expected queries per second (QPS) of the stress testing task. Default value: 10000. This field is optional.
concurrencyThe 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.
agentCountThe 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**
serviceUrlThe 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.
serviceNameThe 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.
requestTokenThe token used to access the service. If the value of **serviceName** is specified, this field can be ignored. This field is optional.
endpointTypeThe 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**
contentThe content of a stress testing request. The value of this field is of the STRING type. This field is optional.
pathThe 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.
dataTypeThe type of the test data. Valid values: text and binary. Default value: text. This field is optional.
multiLineSpecifies 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**
methodThe HTTP request method. Default value: POST. This field is optional.
hostThe host that sends the request. This field is empty by default. This field is optional.
headersThe header of the HTTP request. The header is of the LIST type, such as `["Authorization:aaa", "Content-Type:text"] `. This field is optional.
timeoutThe HTTP request latency. Unit: millisecond. Default value: 20000. This field is optional.

Table 5. Fields in the optional parameter

**Field****Description**
modeThe 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.
adjustIntervalThe 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.
minQPSThe minimum QPS of stress testing. Default value: 100. This field is optional.
maxQPSThe maximum QPS of stress testing. Default value: 10000. This field is optional.
maxRTThe 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.
qpsGrowthDeltaThe QPS increment. Default value: 50. This field is optional.
faultTolerateThe highest request error rate that can be tolerated, excluding errors with the HTTP 200 status code. Default value: 0.001. This field is optional.
faultActionThe 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

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

40325405-579C-4D82********
TaskNamestring

The name of the stress testing task.

benchmark-larec-test-1076
Regionstring

The ID of the region where the stress testing task is performed.

cn-shanghai
Messagestring

The returned message.

Benchmark task [foo] is Creating

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
No change history