All Products
Search
Document Center

Function Compute (2.0):Function performance test

Last Updated:Feb 20, 2024

Performance tests can be used to obtain the maximum queries per second (QPS) of an instance and the optimal concurrency value that meets end-to-end latency requirements. This feature helps efficiently configure the concurrency of functions. In addition, you can use the recommended instance types to reduce costs. This topic describes how to perform a stress test and view the results of the stress test.

Limits

  • You can perform stress tests only on HTTP functions.

  • You can perform a stress test only on one instance at a time.

  • In Python 2.7 and PHP 7.2 runtimes, an 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 of the Configure instance concurrency topic.

  • You cannot perform stress tests on GPU functions.

Billing

You are not charged for the stress test feature. 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, the estimated fees are displayed on the page. For information about the billing of requests, see Billing overview.

Prerequisites

A service and a function are created. For more information, see Create a service and Create a function.

Procedure

  1. Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.

  2. In the top navigation bar, select a region. On the Services page, click the desired service.

  3. On the Functions page, find the function that you want to manage, click the name of the function, and then click the Performance Test tab.

  4. In the Performance Test tab of the function details page, click Create Stress Test Task.

    1. In the Single-instance Stress Test step, enter the required information about the stress test API and click Perform Stress Test.

      Note

      Before you click Perform Stress Test, click Test API to test whether the function can be executed. If the function fails the execution test, the stress test cannot run as expected. 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.

      The following table describes the parameters that you must configure.

      Parameter

      Description

      Stress Test Function

      The function on which you want to perform the stress test. By default, the current function is selected. You cannot change the value of this parameter.

      Function Specifications

      The function specifications that you want to use to perform the stress test. The duration of the stress test increases with the number of specifications that you specify. You can specify custom vCPU and memory specifications.

      Estimated Cost

      The estimated fees for function invocation requests that are generated during the stress test. The fees are automatically calculated by the system.

      Stress Test Method

      The method that is used to trigger the HTTP function. Valid values: GET, POST, PUT, and DELETE.

      Stress Test Path

      The path of the HTTP requests.

      Maximum Tolerable End-to-end Latency

      The maximum end-to-end latency that the function can tolerate. Function Compute recommends the optimal instance specifications and concurrency settings based on the value of this parameter. The following items describe the relationships between end-to-end latency and optimal specifications and between end-to-end latency and concurrency:

      • Optimal specification: the specification that meets performance requirements at the lowest costs.

      • Optimal concurrency: the number of concurrent requests that correspond to the maximum QPS of an instance on condition that the specified maximum latency is met.

    2. In the Result Analysis of Single-instance Stress Test step, view the stress test results.

      During the stress test, the estimated time consumed by the stress test is displayed on the page. The duration and costs of the stress test increase with the number of specifications.

      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 below the stress test results.attribute-test-result

      Note

      You can perform a stress test only on one instance at a time in Function Compute. If you want to perform a stress test on multiple instances, click Stress Test of Multi-instance Elasticity in the Result Analysis of Single-instance Stress Test step to go to the Performance Testing Service (PTS) console.

    3. Click View Details of Single-instance Stress Test to go to the Detailed Data of Single-instance Stress Test step to 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.

      Specifications-test-result

FAQ

Are the recommended optimal specifications and concurrency in the stress test results 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. The values may not be accurate. You can choose the optimal specifications and concurrency settings based on your business requirements.

If you want to obtain accurate results, you can submit multiple stress test tasks and use the average recommended values.

What do I do if a stress test fails or request errors frequently occur?

If an error message that indicates the stress test fails is returned, check the configurations of the stress test API based on the cause. If the API configurations are correct, contact us for technical support.