Database Autonomy Service (DAS) provides the traffic playback and stress testing feature. You can use this feature to check whether your database instance needs to be scaled out or scaled up and verify the performance of the database instance after scale-out or scale-up in real business scenarios to handle workloads during peak hours or schema changes, especially index changes. This helps reduce the possibility of failures. In addition, if your database fails and the cause cannot be identified, you can use a cloned database to reproduce the failure scenario to identify the cause of the failure.
Prerequisites
The source database instance that you want to manage is of one of the following types:
RDS 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 intelligent stress testing feature for PolarDB-X 2.0 only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
Scenarios
Check whether your database instance needs to be scaled up or scaled out to handle workloads during peak hours.
After the schema, especially the indexes, of a database is changed, check the performance of the database in real business scenarios to reduce the risk of failures.
After a database failure occurs, use this feature to recur the failure on a cloned database of the source database to identify the failure cause.
Usage notes
To reduce network latency, you must deploy the stress testing client and the destination database instance in the same region.
NoteWe recommend that you deploy the stress testing client and the destination database instance in the same virtual private cloud (VPC).
Before you perform stress testing, you must check the connectivity between the stress testing client and the destination database instance to ensure that traffic can be sent from the client to the destination database instance.
Billing
For more information about the billing of DAS Enterprise Edition, see Billing overview.
After you create a stress testing task, you are charged based on the following rules:
If you use the Restore by Backup method to migrate data, the system automatically creates a pay-as-you-go database instance based on the type of the destination database instance that you specify. For more information about the billing of the destination database instance, see the billing of the database service.
If you select DAS Automatic Purchase and Deployment in the Advanced Settings section, the system automatically creates a pay-as-you-go Elastic Compute Service (ECS) instance as the stress testing client based on the queries per second (QPS) of the source database instance and the specified playback rate. For more information about the billing of ECS instances, see Instance types.
NoteTo reduce costs, we recommend that you delete the pay-as-you-go instances that are created by the system after the stress testing task is complete.
Procedure
Log on to the DAS console.
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 page that appears, click the SQL Explorer tab. On the SQL Explorer tab, click the Traffic Playback and Stress Test tab.
On the Traffic Playback and Stress Test tab, 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.
NoteMake sure that the SQL Explorer and Audit feature is enabled for the source database instance during the traffic playback period.
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 intelligent 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 intelligent stress testing on one or more databases in the source database instance, click Advanced Settings to specify the Database Account and Password of the destination databases. Click Obtain Database to obtain the information about databases, and then select the databases on which you want to perform intelligent 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 intelligent 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 to be 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 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 it 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.
View intelligent stress testing results
After the stress testing task is created, you can view the information about the stress testing task on the Task Center page.
You can perform the following operations in the Actions column:
Click Details to view the status and report of the stress testing task on the Intelligent Stress Testing Details page. The following table describes the tabs on the page.
Tab
Description
Cluster-level Summary
You can compare the basic information about the source database instance and the destination database instance before and after the stress testing task.
Performance Trend Comparison
You can compare the performance metrics that are collected from the source database instance and the destination database instance before and after the stress testing task.
SQL Comparison
If autonomy features are enabled for the destination database instance before the stress testing, the performance data of SQL execution is collected during the stress testing. For more information about how to enable autonomy features, see Enable autonomy features. You can analyze and compare the performance of SQL execution on the source database instance and the destination database instance before and after the stress testing.
NoteYou can determine whether to update the database engine that your database instance runs or change the specifications of your database instance based on the information that is displayed on the SQL Comparison tab.
Parameter Comparison
You can compare the values of important parameters that are collected from the source database instance and the destination database instance.
Click Terminate to terminate the stress testing task before the task is complete.
Click Delete to delete the stress testing task.
What to do next
If you do not need to perform stress testing again, you can go to the Intelligent Stress Testing Details Details page and then release the ECS instance that is created to run the stress testing task.
If the SQL Explorer and Audit feature is enabled for the source database instance, disable this feature after the stress testing task is complete. For more information, see Disable SQL Explorer and Audit.
If your database instance needs to be scaled out or scaled up to handle workloads during upcoming short-term peak hours, you can enable automatic performance scaling or scheduled auto scaling based on the instance type.
Related API operations
Operation | Description |
Creates stress testing tasks. | |
Runs a stress testing task. | |
Stops a stress testing task. | |
Creates a stress testing task on Advanced Database & Application Migration (ADAM). | |
Deletes a stress testing task. | |
Deletes the metadata of a stopped database gateway. | |
Queries the configurations of a stress testing task. | |
Queries the information about a stress testing task. | |
Queries a list of stress testing tasks. |