Traffic playback and stress testing

Updated at:
Copy as MD

This topic explains how to use traffic playback and stress testing before a major version upgrade.

Overview

The traffic playback and stress testing feature of Database Autonomy Service (DAS) lets you replay your production workload on a target-version PolarDB instance before a major version upgrade. This helps you:

  • Validate whether your instance specifications need to be scaled up to handle traffic spikes.

  • Analyze differences in SQL template execution performance between the source and target PolarDB versions.

Prerequisites

  • Create an instance for traffic playback and stress testing, which this topic refers to as the destination instance for traffic playback and stress testing. This instance must run the same version as the target instance for the major version upgrade. You can also purchase this instance during task configuration.

    Note

    Do not use the destination instance for traffic playback and stress testing in a production environment.

  • Connect the source instance and the destination instance for traffic playback and stress testing to DAS. For more information, see Connect an Alibaba Cloud database instance to DAS.

  • Enable DAS Professional Edition for both the source instance and the destination instance for traffic playback and stress testing. For more information, see Manage DAS audit logs and O&M services (formerly Economy Edition).

  • Prepare an ECS instance to use as the stress testing client. The ECS instance must be in the same region as the destination instance for traffic playback and stress testing. You can also have DAS automatically purchase an instance during task configuration.

    Note

    We recommend that you deploy the stress testing client and the destination instance for traffic playback and stress testing in the same Virtual Private Cloud (VPC).

Usage notes

  • Stress testing does not affect the source instance, so you do not need to run it during off-peak hours.

  • Before starting the stress test, check the network connectivity between the stress testing client and the destination instance for traffic playback and stress testing.

Billing

Traffic playback and stress testing may incur the following fees:

  • Fees for DAS Professional Edition. For more information about pricing, see Introduction to DAS audit logs.

  • Fees for DTS migration. For more information about pricing, see Billable items.

  • (Optional) Fees for the destination instance for traffic playback and stress testing. For more information about pricing, see Billing overview. You can skip this item if you use an existing instance.

  • (Optional) If you choose to purchase a new ECS instance as the stress testing client during task configuration, DAS automatically purchases a pay-as-you-go ECS instance with suitable specifications based on the QPS of the source database and the playback speed. For more information about pricing, see Instance billing.

Procedure

Create a stress test task

This section uses Playback Traffic Stress Test as an example to show you how to create a stress test task.

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Traffic Playback and Stress Testing.

  3. On the Tasks page, click Create Task in the upper-right corner.

  4. In the Create Task dialog box, set the following parameters.

    Parameter

    Description

    Task Type

    Select Playback Traffic Stress Test.

    Job Name

    Enter a name for the stress test task. The name must be 2 to 50 characters in length.

    Instance source

    Select Alibaba Cloud Database.

    Database type

    The database engine of the source instance. Select PolarDB for MySQL.

    Source Instance

    Select the instance ID of the Source Instance.

    Advanced Settings

    To test specific databases on the source instance, click Advanced Settings, provide the Database Account and Password for the source databases to obtain database information, and then select the databases that you want to test.

  5. Click Next and set the following parameters.

    Parameter

    Description

    Database type

    The database engine of the destination instance. Select PolarDB for MySQL.

    Benchmark data migration

    Select Create DTS Migration Task.

    Note

    If you select Create DTS Migration Task, the system automatically creates a data migration task. You do not need to perform operations in the DTS console.

    DTS migration task specifications

    Select the specifications for the DTS migration task.

    Destination Instance

    Select the destination instance for traffic playback and stress testing. By default, the system accesses the primary endpoint of the destination instance.

    Privileged account of destination instance

    The username and password for the destination instance's privileged account.

    Privileged account of source instance

    The username and password for the source instance's privileged account.

    Select playback traffic

    Select the time range of the traffic to replay.

    Note

    The SQL Explorer and Audit feature must have been active on the source instance during this time range.

    Playback speed

    The speed at which source instance traffic is replayed on the destination instance. For example, a value of 1 indicates that the traffic is replayed at the original speed. The playback speed must be a positive integer from 1 to 30.

    Note

    If the playback speed that you set exceeds the maximum speed supported by the destination instance for traffic playback and stress testing, the task runs at the maximum speed supported by the destination instance.

    Advanced Settings

    Select an ECS instance on which to deploy the stress testing client.

    Note
    • You can select DAS Automatic Purchase and Deployment. The system then purchases a pay-as-you-go ECS instance with suitable specifications based on the QPS of the source database and the specified playback speed.

    • You can also click Add to select an ECS instance on which to deploy the stress testing client, generate a deployment command, and then copy and run the command on that ECS instance. You must also run the sudo yum install -y java-1.8.0-openjdk command on the selected ECS instance to install the Java client. We recommend using Java 8 for the client.

  6. Click Next.

  7. Click OK to create the stress test task.

View stress test details

After creating a stress test task, you can view it on the Tasks page. In the Operation column, you can perform the following operations:

  • Click Details to open the Traffic Playback and Stress Testing Details page. On this page, you can view the execution status of the task and the stress test report. The following table describes the information on the page.

    Parameter

    Description

    Overview

    Compares basic information about the source and destination instances before and after the stress test.

    Performance trend comparison

    Compares various performance metrics between the source and destination instances.

    SQL comparison

    If you have already enabled or disabled the Autonomy Service on the destination instance for traffic playback and stress testing before the stress test, you can analyze the performance difference of SQL templates between the source and destination instances before and after the stress test.

    Note

    The SQL comparison tab can be used for scenarios such as database engine upgrades and specification changes.

    Parameter Comparison

    Compares important parameters between the source and destination instances.

  • To stop a running stress test task, click Terminate.

  • Click Delete to delete the stress test task.

Release resources

After the stress test is complete and no longer needed, go to the Traffic Playback and Stress Testing Details page to release the test ECS instance. If you no longer need the destination instance for traffic playback and stress testing, you can release the destination instance for traffic playback and stress testing.