You can perform stress tests on functions in Function Compute. Stress tests can be used to obtain the maximum queries per second (QPS) of a single instance and the optimal concurrency value that meets end-to-end latency requirements. This feature helps configure concurrency of functions in a more efficient manner. In addition, you can use the recommended instance specifications to reduce costs. This topic describes how to perform a stress test and view the results of the stress test.
- You can perform stress tests only on HTTP functions. You cannot perform stress tests on event functions.
- You can perform a stress test only on a single instance, not on multiple instances.
- In Python 2.7 and PHP 7.2 runtimes, a single instance cannot concurrently process multiple requests. Therefore, you cannot perform a stress test to detect the optimal concurrency of an instance in a Python 2.7 or PHP 7.2 runtime. For more information, see the "Limits" section in Configure instance concurrency.
You are not charged for using the stress test feature. However, you are charged for the function invocation requests that are generated during the stress test in the same way as regular function invocation requests. Each time you create a stress test task, an estimated fee is displayed on the page. For more information about the billing of invocation requests, see Billing overview.
- Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
- In the top navigation bar, select a region. On the Services page, click the desired service.
- On the Functions page, click the name of the function on which you want to perform a stress test. On the page that appears, click the Performance Probe tab.
- On the Performance Test tab, click Create Stress Test Task.
- On the Single-instance Stress Test tab, enter the API information of the stress test before you click Perform Stress Test. The following table describes the parameters.Note Before you click Perform Stress Test, click Test API to test whether the function can be successfully executed. The stress test cannot run as expected if the function fails the execution test. Therefore, make sure that the function code is valid and the HTTP request parameters of the API that is used to perform the stress test are correctly configured. Perform the stress test after the execution test is successful.
Parameter Description Stress Test Function The function on which you want to perform the stress test. By default, the current function is selected and cannot be changed. Function Specifications The function specifications that you want to use to perform the stress test. The more specifications you specify, the longer the stress test takes. You can customize the vCPU and memory specifications. Estimated Cost The estimated fee for function invocation requests that are generated during the stress test. The value is automatically calculated by the system. Stress Test Method The methods that are used to trigger the HTTP function. The GET, POST, PUT, and DELETE methods are supported. Stress Test Path The path of the HTTP requests. Maximum Tolerable End-to-end Latency The end-to-end latency for the function. Function Compute recommends the optimal instance specifications and concurrency settings based on the value of this parameter. The following items describe the relationship between end-to-end latency and optimal specifications and concurrency:
- Optimal specification: the specification that meets performance requirements at the lowest cost.
- Optimal concurrency: the number of concurrent requests that corresponds to the maximum QPS of a single instance on condition that the specified maximum latency is met.
- On the Result Analysis of Single-instance Stress Test tab, view the results of the stress test. During the stress test, the estimated time of the stress test is displayed on the page. The more the specifications you specify for the stress test, the longer the stress test takes and the more the cost.The stress test results include the recommended instance specifications and the optimal concurrency settings. You can also view the analysis process by using the analysis charts under the stress test results.Note You can perform a stress test only on a single instance in Function Compute. To perform a stress test on multiple instances, click Stress Test of Multi-instance Elasticity on the Result Analysis of Single-instance Stress Test tab to go to the Performance Testing (PTS) console.
- Click View Details of Single-instance Stress Test. On the Detailed Data of Single-instance Stress Test tabs, you can view the stress test details of each specification. In the stress test details of each specification, you can view the changes in latency and maximum QPS as the concurrency increases.
- On the Single-instance Stress Test tab, enter the API information of the stress test before you click Perform Stress Test.
Are the recommended optimal specifications and concurrency in the stress test results completely accurate?
The recommended concurrency and specification values of each stress test can be used as a reference for evaluating the performance of different specifications of the function, but may not be completely accurate. You can choose the optimal specifications and concurrency settings based on your business requirements.
If you want to obtain more accurate results, you can submit multiple stress test tasks and use the average values.