All Products
Search
Document Center

Performance Testing:HTTP APIs

Last Updated:Nov 01, 2024

HTTP API settings include basic request details, request headers, request bodies, response parameters, and check points (assertions). The settings are widely used in test request scenarios that specify the HTTP protocol, and scenarios where you need to combine response parameters to extract content from the response or where you need to combine check points to check whether the response meets expectations from the business dimension.

Limits

HTTP versions

Performance Testing Service (PTS) supports the HTTP/1.1 and HTTP/2 protocols. When you actually debug or start the stress testing, the PTS stress testing engine automatically negotiates the protocol version with your server. If your server supports the HTTP/2 protocol, PTS preferentially uses the HTTP/2 protocol to interact with the server by default. Otherwise, PTS uses the HTTP/1.1 protocol to interact with the server. Therefore, you do not need to pay attention to the used HTTP protocol version when you configure a scenario.

HTTP request headers

When you use HTTP/2 request headers, some request headers may be abnormal, as specified in the HTTP/2 RFC standard. If the ProtocolException:*** is illegal for HTTP/2 messages message appears after you debug an API, you must delete the header that corresponds to *** from the request header configuration.

The following HTTP/2 request headers are invalid and case-insensitive:

  • Connection

  • Keep-Alive

  • Proxy-Connection

  • Transfer-Encoding

  • Host

  • Upgrade

Request timeout period

The request timeout refers to the timeout of one of the following durations in the actual request sending process. The timeout of any duration causes a request to time out.

  • Duration from sending a request to receiving the response packet for the first time

  • Interval between any two consecutive response packets

    The socketTimeOut parameter indicates the interval timeout, that is, the time when a client interacts with a server. If the interval exceeds the interaction time, the interval times out. Note that the interaction time does not indicate the overall interaction time. For example, you specify the timeout period to 10 seconds, which indicates the interaction time between your client and server. If data is transmitted every 8 seconds (the time between two consecutive packets) and is transmitted 10 times, the overall interaction time is 80 seconds. In this case, no timeouts occur. However, if data is transmitted every 12 seconds, which indicates that the time between any two consecutive packets exceeds 10 seconds, a timeout occurs.

Important

If you configure the request timeout period in the Basic Request Information and Advanced Settings sections of an HTTP API, the request timeout settings of the HTTP API overwrite the request timeout settings in the Advanced Settings section.

  • For more information about how to set the request timeout period in the Basic Request Information section, see Basic request information.

Basic request information

The basic request information displayed on the HTTP API configuration page generally includes the API name, stress testing URL, and request method. For more information, see Basic request information.

Specify custom request information

  • Header settings

    To specify a special request for the stress testing, you can define a header.

  • Body settings

    To further specify a special request for the stress testing or a specified header cannot meet your stress testing requirements, you can define a body.

  • Response parameters

    In actual stress testing scenarios, response parameters are often used to extract content from the response to check whether a request is successful from the business dimension.

  • check points (assertions)

    In actual stress testing scenarios, check points are often used to check whether a request is successful from the business dimension.

Advanced settings

  • Domain name mapping

    You can specify the IP address that corresponds to a domain name. During the stress testing, the stress testing traffic directly access the bound IP address to implement the stress testing on the target service.

  • HTTPS settings

    During the stress testing in PTS, you can turn on SSL Status Loop Resetting and select an SSL protocol in the HTTPS Settings subsection of the Advanced Settings section.