The traffic playback and stress testing feature replays captured production SQL traffic in a test environment. Use it to prepare for traffic spikes, validate schema changes such as new indexes, or determine if you need to scale your instance. By simulating real-world workloads, you can reduce the risk of production failures. You can also use it to reproduce a failure on a cloned database to help diagnose the root cause.
Prerequisites
-
SQL Insight and Stress Testing (New Version) is enabled.
-
Only the following regions are supported: China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore.
Use cases
-
Validate if your current instance specifications can handle an upcoming traffic spike.
-
Test the real-world impact of schema changes, especially index modifications, to reduce the risk of failures after deployment.
-
Reproduce a failure scenario on a cloned database to diagnose the root cause when you cannot identify it on the live system.
Usage notes
-
To minimize network latency during testing, ensure the stress testing client and the destination instance are in the same region.
NoteFor best results, place the stress testing client and the destination instance in the same VPC.
-
Stress testing does not affect the source instance. You do not need to run it during off-peak hours.
-
Before you start the test, verify the network connectivity between the stress testing client and the destination instance to ensure that traffic can be sent.
Procedure
-
On the SQL Explorer tab, click the Traffic Playback and Stress Test tab.
-
Click Create Task and configure the source instance.
In the dialog box that appears, set Task Type to Replay Online Instance and enter a Task Name. In the source information area, set Instance Source to Alibaba Cloud DB and Database engine to PolarDB-X. Then, select the Source Instance. If you need to connect to an unlisted instance, click Access Instance. To expand more options, click Advanced Settings. Click Next.
Note-
For the PolarDB-X database engine, this feature is currently available only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
-
Ensure that SQL Insight and Stress Testing (New Version) is enabled on the source instance for the entire playback time range.
-
-
Configure the settings for the destination instance.
Parameter
Description
Database type
The destination instance must be an ApsaraDB RDS for MySQL, PolarDB for MySQL, or PolarDB-X instance.
Benchmark data migration
Select a method based on whether you have already migrated the baseline data from the source instance to the destination instance:
-
Restore by backup: Creates the destination instance by restoring the source instance from a specific point in time or a backup set.
Note-
Restore Method: You can select By Point in Time or By Backup Set. If you select By Backup Set, you must grant permissions to the DAS Service-linked Role. In the dialog box, click OK.
-
Select restore time/backup set: Select the specific point in time or backup set for the restore.
-
-
Data migration completed: Use this option if you have already set up a data migration task for the destination instance.
NoteTo ensure the stress test runs correctly, the table structure and data on the destination instance must be identical to the source instance.
-
Enter DTS task ID: Use this option if you have created a data migration task in the Data Transmission Service (DTS) console. Enter the Task ID from the completed data synchronization task.
NoteFor more information about data migration with DTS, see Data migration.
-
Create DTS migration task: Create a DTS data migration task directly from this interface without navigating to the DTS console.
NoteThe available benchmark data migration methods vary depending on the database engine.
Destination Instance
Select the destination instance. By default, the system sends traffic to the primary endpoint of the destination instance.
NoteYou can click Advanced Settings on the right of the destination instance to stress test multiple nodes by specifying a cluster endpoint. The Advanced Settings option is currently available only when the destination instance is a PolarDB for MySQL cluster and the Baseline Data Migration status is Data migration completed.
Privileged account of destination instance
The username and password for the privileged account.
Select playback traffic
Select the time range of the traffic to replay.
Playback speed
-
This setting controls the replay speed of source instance traffic on the destination instance, expressed as a multiplier. For example, 1x means the traffic is replayed at the original speed. The value must be a positive integer from 1 to 30.
-
If the speed you set exceeds the maximum supported by the destination instance, the task will run at the instance's maximum supported speed.
ECS for stress testing program deployment
-
Select DAS automatic purchase and deployment. The system automatically purchases a pay-as-you-go ECS instance with appropriate specifications based on the source QPS and playback speed.
-
Click Add to select an existing ECS instance to deploy the stress testing program. Generate the deployment command, then copy and run it on the instance. You must also run the
sudo yum install -y java-1.8.0-openjdkcommand on the ECS instance to install Java. We recommend using Java 8.
-
-
Click Next. After the Precheck completes, click OK to create the task.
-
In the Operation column, you can perform the following operations:
-
Click Details to open the Intelligent Stress Testing Details page and view the task status and the stress testing report. The following table describes the report sections.
Parameter
Description
Overview
A comparison of basic information between the source and destination instances.
Performance trend comparison
A comparison of various performance metrics between the source and destination instances.
SQL comparison
If autonomy features were enabled on the destination instance before the task, you can compare the SQL execution performance between the source and destination instances.
NoteThe SQL comparison tab is useful for scenarios such as database engine upgrades or instance specification changes.
Compare Parameters
A comparison of key parameters between the source and destination instances.
-
To stop the stress test task before it finishes, click Terminate.
-
Click Delete to delete the task.
NoteAfter the task completes, go to the Intelligent Stress Testing Details page. If you do not need to run another stress test, release the ECS instance.
-