Database Autonomy Service (DAS) provides the intelligent stress testing feature. This feature helps you check whether you need to scale up your instance to handle workloads during peak hours. This topic describes how to create a stress testing task.
Prerequisites
The source instance that you want to manage is of one of the following types:
ApsaraDB RDS for MySQL High-availability Edition, Enterprise Edition, and Cluster Edition
PolarDB for MySQL Cluster Edition, X-Engine Edition, and Multi-master Cluster (Database/Table) Edition
PolarDB-X 2.0
The destination 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 instance and the destination 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 Professional Edition is activated for the source instance. For more information, see Purchase DAS Professional Edition.
NoteIf you want to analyze and compare the performance of SQL execution on the source instance and the destination instance before and after the stress testing, you must also activate DAS Professional Edition for the destination instance. You can determine whether you need to upgrade the database engine that your instance runs or change the specifications of your instance based on the performance differences in the SQL execution.
PolarDB-X 2.0 is supported 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 instance in the same region.
NoteWe recommend that you deploy the stress testing client and the destination 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 instance to ensure that traffic can be sent from the client to the destination instance.
Billing
For more information about the pricing of DAS Professional Edition, see Pricing of DAS Professional Edition.
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 creates a pay-as-you-go database instance based on the type of the destination instance that you specify. For information about the pricing of the destination instance, see the pricing of the corresponding database service.
If you select DAS Automatic Purchase and Deployment in the Advanced Settings section, the system creates a pay-as-you-go Elastic Compute Service (ECS) instance based on the queries per second (QPS) of the source instance and the specified playback rate. For more information about the pricing of ECS instances, see ECS billing methods.
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 completed.
Procedure
In the following example, a Playback Traffic Stress Test task is created.
Log on to the DAS console.
In the left-side navigation pane, click Intelligent Stress Testing.
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.
Parameter
Description
Instance Source
Select Alibaba Cloud Database.
Database Engine
The type of the source instance. Valid values:
MySQL: The source instance is an ApsaraDB RDS for MySQL instance.
PolarDB for MySQL: The source instance is a PolarDB for MySQL cluster.
PolarDB-X: The source instance is a PolarDB-X 2.0 instance.
NotePolarDB-X 2.0 is supported 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 instance, click Advanced Settings to specify the database account and password of the destination databases. Click Obtain Database to obtain the required databases, and then select the destination 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 instance. Valid values:
MySQL: The destination instance is an ApsaraDB RDS for MySQL instance.
PolarDB for MySQL: The destination instance is a PolarDB for MySQL cluster.
PolarDB-X: The destination instance is a PolarDB-X 2.0 instance.
NotePolarDB-X 2.0 is supported only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore regions.
Benchmark Data Migration
The method used to migrate data. Select a method based on whether the baseline data can be migrated from the source instance to the destination instance. Valid values:
Restore by Backup: Data in the source instance is cloned to the destination instance based on a specified point in time or a specified backup set.
NoteThe system creates a pay-as-you-go instance that has the same specifications as the source instance and restores the backups to this instance.
Data Migration Completed: The table schema and data of the source instance are migrated to the destination instance in a specified time range within which the traffic is replayed.
NoteThe destination instance must have the same table schema and data type as the source 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 instance to the destination 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 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, after a stress testing task is created, the system creates a pay-as-you-go instance that has the same specifications as the source instance and restores the data of the source instance to the created instance.
If the source instance is a self-managed database, you can select Data Migration Completed, Enter DTS Task ID, or Create DTS Migration Task.
Restore Method
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 when 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 when 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 instance to the destination instance.
NoteThis parameter is required only when the Benchmark Data Migration parameter is set to Enter DTS Task ID.
DTS Migration Task Specifications
The specifications of the DTS migration task.
NoteThis parameter is required only when the Benchmark Data Migration parameter is set to Create DTS Migration Task.
Destination Instance
The name of the destination instance. By default, the system accesses the primary endpoint of the destination instance.
NoteThis parameter is required only when 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 instance.
NoteThis parameter is required only when 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 instance.
NoteThis parameter is required only when 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.
NoteThe SQL Explorer and Audit feature is enabled for the source instance within the specified time range.
Playback Speed
The rate at which the traffic captured from the source instance is replayed on the destination instance. For example, if you set this parameter to 1, the traffic is replayed on the destination 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 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 based on the QPS of the source 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 OK.
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 state and report of the stress testing task on the Intelligent Stress Testing Details page. The following table describes the parameters.
Parameter
Description
Cluster-level Summary
You can compare the basic information about the source instance and the destination instance before and after the stress testing.
Performance Trend Comparison
You can compare the performance metrics of the source instance and the destination instance before and after the stress testing.
SQL Comparison
If DAS Professional Edition is activated for the destination instance before the stress testing, the performance data of SQL execution is collected during the stress testing. You can analyze and compare the performance of SQL execution on the source instance and the destination instance before and after the stress testing.
NoteYou can check whether you need to upgrade 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 instance and the destination instance.
Click Terminate to terminate the stress testing task before the task is completed.
Click Delete to delete the stress testing task.
NoteIf you do not need to perform stress testing again, you can release the ECS instance that is created to run the stress testing task on the Intelligent Stress Testing Details page.