Stress test TCP

Updated at:

This topic describes how to use the PTS console to quickly perform performance testing for the TCP protocol.

Procedure

  1. Log on to the PTS console. In the navigation pane on the left, choose performance testing > Create Scenario, and then click TCP/UDP stress test.
  2. On the Create TCP/UDP Scene page, enter a scene name and set Protocol type to TCP.

  3. On the Scene configuration tab, click + Add TCP Request Node to add test nodes to the target serial link.

Scene configuration

Click the ryi icon to the right of a serial link to expand it. Then, you can configure its basic information, output parameters, and checkpoints.

Basic configuration

On the Basic configuration tab of the serial link, configure the basic parameters for the test.

Parameter

Description

Example

IP address

The IP address of the TCP service.

192.168.1.1

Port number

The port number of the TCP service.

5001

Connection timeout

The timeout period for a connection attempt. If the server does not respond within this period, the connection attempt fails.

5000

Response timeout

After a connection is established, this specifies the timeout period for waiting for a response from the server.

5000

Reuse connection

Keeps the connection open after a request-response cycle, allowing reuse for the next request.

N/A

Close connection

Closes the connection after each request-response cycle. A new connection is established for the next request.

N/A

Use Nagle's algorithm

Specifies whether to enable Nagle's algorithm for TCP connections. The optimal setting depends on your specific business requirements.

On

End of line

The byte value that indicates the end of a line. For example, if the server's response strings always end with a newline character, set this option to 10.

Important

The end-of-line value specifies a terminating byte in the data stream from the server. If this value is not set, the system reads until the input stream ends. This value must be a decimal, not hexadecimal. For example, you can refer to an ASCII table to find the decimal value for a specific terminating character.

10

Content format

Supported formats are string and hexadecimal stream.

String

Request content

The content to send.

Hi

Output parameters

On the Output parameter settings tab of the serial link, configure the output parameters. For detailed instructions, see API output parameters.

Checkpoints

On the Checkpoint settings tab of the serial link, set checkpoints. For detailed instructions, see Checkpoints (assertions).

Controllers and timers (optional)

You can add controllers and timers as your task requires.

  • On the scene configuration tab, click + Add controller and select a controller.

    • Loop controller: Controls the number of times the test nodes within it are executed.

      Select a loop controller and click the More icon for the loop controller icon to its right to add the test nodes to be executed in the loop and set the number of loops. During a stress test, the test nodes within this loop controller are executed sequentially for the specified number of times.

    • Transaction controller: A transaction controller groups all test nodes under it into a single transaction. It has two settings: Generate parent sample and Include duration of timers and pre-post processors in sample time.

      • Generate parent sample:

        • Enabled: The system does not report the individual test results for each node under this transaction controller. Instead, it aggregates and presents them as a single result for the transaction controller in the performance test report.

        • Disabled: The report displays test results for both the transaction controller and each individual node under it.

      • Include duration of timers and pre-post processors in sample time: If you enable this option, the average response time of the transaction controller in the performance test report is the sum of the average response times of all test nodes, timers, and pre/post processors. If you disable this option, the average response time includes only the sum of the average response times of the test nodes.

    • Once only controller: Nodes under a once only controller execute only once.

  • On the scene configuration tab, click + Add timer and select a timer.

    • Constant timer: Adds a fixed delay. This timer pauses execution for the specified duration in milliseconds.

    • Synchronous timer: You can set the Pause duration and the Number of simulated users. This timer holds threads until the specified number of users is reached, and then releases them all at once to create a burst of load. If the number of users does not reach the target within the timeout period, the timer releases the waiting threads.

    • Uniform random timer: This timer introduces a delay that consists of a fixed part and a random part. You can configure the Constant delay offset (the fixed delay) and the Random delay maximum (the maximum random delay). The total delay is the sum of the constant offset and a random value between 0 and the random maximum. Each random value in the range has an equal probability of being chosen.

    • Gaussian random timer: Similar to the uniform random timer, this timer also sets a delay with a Constant delay offset and a Random delay maximum. Use this timer when you need the random portion of the delay to follow a normal (Gaussian) distribution.

    • Constant throughput timer: This timer controls the throughput, ensuring that test nodes execute at a specified rate. You can set the target throughput and the basis for its calculation. The calculation can be based on: this thread only, all active threads, all active threads in current thread group, all active threads (shared), or all active threads in current thread group (shared).

Stress configuration

Click the Load Settings tab to configure the load settings.

Parameter

Description

Load Source

The network type used for the test. Options include public network and Alibaba Cloud VPC private network. For more information, see Stress source (public network and VPC).

Number of concurrent users

The number of virtual users that initiate requests simultaneously. For example, a value of 100 means 100 virtual users are sending requests concurrently.

Test Duration

The recommended test duration is at least 2 minutes. The maximum duration is 24 hours by default.

Traffic model

This setting defines the increment model for the number of concurrent users. When you select a different traffic model, the stress estimation chart on the right side of the page also refreshes.

  • Uniform ramp-up: The default model. The number of concurrent users increases at a constant rate per minute. The corresponding Estimated Load graph is a straight diagonal line.

  • Stepped ramp-up: The number of concurrent users increases in steps. The load on the system increases in stages; the number of concurrent users increases by a set amount in each time interval until the target is reached, after which the system maintains this concurrency for a period. The corresponding Estimated Load graph is a step chart.

  • Constant load: The number of concurrent users is constant. The corresponding Estimated Load graph is a flat horizontal line, indicating that the test runs with the specified number of concurrent users from start to finish.

Ramp-up period

The time it takes for all concurrent users to become active, starting from zero. You must configure this setting when the traffic model is set to uniform ramp-up or stepped ramp-up.

Number of steps

The number of steps to complete the ramp-up. You must configure this setting when the traffic model is set to stepped ramp-up.

Specified IP Addresses

The number of source IP addresses to use for the test. For more information, see Specify the number of stress IPs.

Custom traffic region

Simulate user traffic from specific geographical locations by specifying the location of the stress-generating machines. After you enable this feature, you can configure the regional distribution of the stress machines to customize the geographical distribution of your test traffic. For more information, see Customize regional traffic.

Start the test

In the lower-left corner of the page, click Debug to validate your configuration. For more information, see Debug a scene. Then, click Save and Start and click OK in the confirmation dialog box to start the test.

Next steps

View the performance test report. For more information, see View a multi-protocol performance test report.