Database Autonomy Service (DAS) provides the traffic playback and stress testing feature. This feature helps you check whether you need to scale out or up your database instance to handle workloads during peak hours. This topic describes how to create a stress testing task.
Prerequisites
The source database instance that you want to manage is of one of the following types:
ApsaraDB RDS for MySQL
PolarDB for MySQL
NotePolarDB for MySQL Single Node Edition is not supported.
PolarDB-X 2.0
The destination database instance that you want to manage is of one of the following types:
ApsaraDB RDS for MySQL
PolarDB for MySQL
PolarDB-X 2.0
The source database instance and the destination database instance are connected to DAS. For more information about how to connect database instances to DAS, see Connect an Alibaba Cloud database instance to DAS.
DAS Enterprise Edition is enabled for the source database instance. For more information, see Enable and manage DAS Economy Edition and DAS Enterprise Edition.
NoteIf you want to analyze and compare the performance of SQL execution on the source database instance and the destination database instance before and after the stress testing, you must also enable DAS Enterprise Edition for the destination database instance. You can determine whether to update the database engine that your database instance runs or change the specifications of your database instance based on the performance differences in SQL execution.
DAS supports the traffic playback and stress testing feature for PolarDB-X 2.0 only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
Procedure
Log on to the DAS console.
Go to the Traffic Playback and Stress Testing page.
You can use one of the following methods to go to the Traffic Playback and Stress Testing page:
In the left-side navigation pane, click Traffic Playback and Stress Testing.
Go to the Traffic Playback and Stress Testing page from the instance details page.
In the left-side navigation pane, click Instance Monitoring.
On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.
In the left-side navigation pane, choose Request Analysis > SQL Explorer and Audit. On the SQL Explorer tab, click the Traffic Playback and Stress Test tab.
On the Task Center page, click Create Task in the upper-right corner.
In the Create Task dialog box, configure the parameters.
Set the Task Type parameter to Playback Traffic Stress Test and configure the Task Name parameter.
In the Source Information section, configure the parameters that are described in the following table. Then, click Next.
Parameter
Description
Instance Source
Select Alibaba Cloud Database.
Database Engine
The type of the source database instance. Valid values:
MySQL: an ApsaraDB RDS for MySQL instance.
PolarDB for MySQL: a PolarDB for MySQL cluster.
PolarDB-X: a PolarDB-X 2.0 instance.
NoteDAS supports the traffic playback and stress testing feature for PolarDB-X 2.0 only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
Source Instance
The ID of the source instance.
Advanced Settings
If you want to perform traffic playback and stress testing on one or more databases in the source database instance, click Advanced Settings to specify the Database Account and Password values of the destination databases. Click Obtain Database to obtain the information about databases, and then select the databases on which you want to perform traffic playback and stress testing.
In the Generation Method of Schema and Data of Destination Database section, configure the parameters that are described in the following table.
Parameter
Description
Database Engine
The type of the destination database instance. Valid values:
MySQL: an ApsaraDB RDS for MySQL instance.
PolarDB for MySQL: a PolarDB for MySQL cluster.
PolarDB-X: a PolarDB-X 2.0 instance.
NoteDAS supports the traffic playback and stress testing feature for PolarDB-X 2.0 only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
Benchmark Data Migration
The method that is used to migrate data. Select a method based on whether the baseline data can be migrated from the source database instance to the destination database instance. Valid values:
Restore by Backup: Data in the source database instance is cloned to the destination database instance based on a point in time or a backup set.
NoteThe system automatically creates a pay-as-you-go database instance that has the same specifications as the source database instance and restores the backup data to the created database instance.
Data Migration Completed: The table schemas and data of the source database instance are migrated to the destination database instance in the specified time range within which the traffic is replayed.
NoteThe destination database instance must have the same table schemas and data as the source database instance. Otherwise, the stress testing cannot be performed.
Enter DTS Task ID: A data migration task is created in the Data Transmission Service (DTS) console to migrate data from the source database instance to the destination database instance.
NoteFor information about how to migrate data in DTS, see Data migration.
Create DTS Migration Task: A DTS data migration task is created. You do not need to create the migration task in the DTS console.
NoteIf the source database instance is an Alibaba Cloud database instance, you can select one of the preceding methods to migrate data. We recommend that you select Restore by Backup. If you select Restore by Backup, the system automatically creates a pay-as-you-go database instance that has the same specifications as the source database instance and restores the data of the source database instance to the created database instance.
If the source database instance is a self-managed database, you can select only Data Migration Completed, Enter DTS Task ID, or Create DTS Migration Task.
Restore Mode
The method that is used to restore data. You can select one of the following methods based on your business requirements:
By Time Point
By Backup Set
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Restore by Backup.
If you set the Restore Mode parameter to By Backup Set, make sure that your account is granted the required permissions. If your account is not granted the permissions, click DAS Service-linked Role to assign the associated role to your account. In the message that appears, click OK.
Select Restore Time/Backup Set
The point in time at which you want to restore data or the backup set from which you want to restore data. You can specify a point in time or a backup set based on the value of the Restore Mode parameter.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Restore by Backup.
Migration Task ID
The ID of the DTS data migration task that is used to migrate data from the source database instance to the destination database instance.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Enter DTS Task ID.
DTS Migration Task Specifications
The specifications of the DTS data migration task.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Create DTS Migration Task.
Destination Instance
The name of the destination database instance. By default, the system accesses the primary endpoint of the destination database instance.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Data Migration Completed, Enter DTS Task ID, or Create DTS Migration Task.
Privileged Account of Destination Instance
The name and password of the privileged account for the destination database instance.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Data Migration Completed, Enter DTS Task ID, or Create DTS Migration Task.
Privileged Account of Source Instance
The name and password of the privileged account for the source database instance.
NoteThis parameter is required only if the Benchmark Data Migration parameter is set to Restore by Backup or Create DTS Migration Task.
In the Stress Testing Basic Settings section, configure the parameters that are described in the following table.
Parameter
Description
Select Playback Traffic
The time range within which the traffic is replayed.
NoteMake sure that the SQL Explorer and Audit feature is enabled for the source database instance within the specified time range.
Playback Speed
The rate at which the traffic captured from the source database instance is replayed on the destination database instance. For example, if you set this parameter to 1, the traffic is replayed on the destination database instance at the original rate. The playback rate must be a positive integer. Valid values: 1 to 30.
NoteIf the specified playback rate is higher than the maximum playback rate that is supported by the destination database instance, the traffic is replayed at the maximum playback rate.
In the Advanced Settings section, configure the ECS that Deploys Stress Testing Program parameter.
If you set the parameter to DAS Automatic Purchase and Deployment, the system automatically creates a pay-as-you-go ECS instance as the stress testing client based on the QPS of the source database instance and the specified playback rate.
If you want to deploy the stress testing program on your existing ECS instance, click Add to select the ECS instance and click Generate Deployment Command. Then, copy the generated command and run the command on the ECS instance. In addition, you must run the
sudo yum install -y java-1.8.0-openjdk
command to install a Java client on the added ECS instance. We recommend that you install Java 8.
Click Next.
After the verification succeeds, click OK to create the stress testing task.