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

Make sure that your database instances meet the following requirements:
  • The source database instance is an ApsaraDB RDS for MySQL instance of the High-availability Edition, an ApsaraDB RDS for MySQL instance of the Enterprise Edition, a PolarDB for MySQL cluster of the Cluster Edition, a PolarDB for MySQL cluster of the Archive Database Edition, or a PolarDB-X 2.0 instance.
  • The destination database instance is an ApsaraDB RDS for MySQL instance, a PolarDB for MySQL cluster, or a PolarDB-X 2.0 instance.
  • The source instance and the destination instance are connected to DAS. For information about how to connect database instances to DAS, see Connect an Alibaba Cloud database instance to DAS.
  • DAS Professional Edition is enabled for the source instance and the destination instance. For more information, see Usage notes on DAS Professional Edition.
Note PolarDB-X 2.0 is supported only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore (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.

Precautions

  • To reduce network latency, you must deploy the stress testing client and the destination database instance in the same region.
    Note We 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. Make sure that traffic can be sent from the client to the destination instance.

Pricing

  • 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 destination database instance that you specify. For information about the pricing of the destination database instance, see the pricing of the corresponding 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. The specification of the ECS instance is selected based on the queries per second (QPS) of the source database instance and the specified playback rate. For more information about the pricing, see ECS billing methods.
    Note To 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.

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Intelligent Stress Testing.
  3. On the Task Center page, click Create Task in the upper-right corner.
  4. In the Create Task dialog box, configure the parameters.
    z
    1. Set the Task Type parameter to Playback Traffic Stress Test and specify a task name.
    2. 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 database instance. Valid values:
      • MySQL
      • PolarDB MySQL
      • PolarDB-X 2.0
        Note PolarDB-X 2.0 is supported only in the China (Hangzhou), China (Shanghai), China (Beijing), China (Shenzhen), and Singapore (Singapore) regions.
      Source Instance The ID of the source database instance.
    3. In the Generation Method of Schema and Data of Destination Database section, configure the parameters that are described in the following table.
      ss
      Parameter Description
      Database Engine The type of the destination database instance. The destination database instance must be an ApsaraDB RDS for MySQL instance, a PolarDB for MySQL cluster, or a PolarDB-X 2.0 instance that is deployed in the Singapore (Singapore) region.
      Benchmark Data Migration The method of data migration. Select a method based on whether the baseline data of the source database instance can be migrated 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 specified point in time or a specified backup set.
        Note
        • Restore Mode: You can select By Time Point or By Backup Set. If you select By Backup Set, make sure that you are granted the required permissions. If you are not granted the permissions, click DAS Service-linked Role to assign the associated role to the account that you use. In the message that appears, click OK.
        • Select Restore Time/Backup Set: If you set the Restore Mode parameter to By Time Point, specify a point in time to migrate data that is saved at the specified point in time. If you set the Restore Mode parameter to By Backup Set, select a backup set to migrate the data from the selected backup set.
      • Data Migration Completed: Data from the source database instance is migrated to the destination database instance. You do not need to use Data Transmission Service (DTS) to migrate the data.
        Note The destination database instance must have the same table schema and data type as the source database instance. Otherwise, the stress test cannot be performed.
      • Enter DTS Task ID: You can create a data migration task in the DTS console to migrate data from the source database instance to the destination database instance. Enter the ID of the DTS migration task in the Migration Task ID field.
        Note For more information about DTS, see DTS documentation.
      • Create DTS Migration Task: Create a DTS data migration task in this section. You do not need to create the migration task in the DTS console.
      Note
      • If the source database instance is an Alibaba Cloud database instance, you can select one of the preceding methods. We recommend that you select Restore by Backup. If you select Restore by Backup, after a stress testing task is created, the system automatically purchases a pay-as-you-go instance that has the same specification as the source database instance. The system exports the backup data of the source database instance to the purchased instance.
      • If the source database instance is a self-managed database instance, you can select Data Migration Completed, Enter DTS Task ID, or Create DTS Migration Task.
      Destination Instance Select the destination database instance. By default, the system accesses the primary endpoint of the destination database instance.
      Note You can click Advanced Settings next to the Destination Instance field to specify the endpoint of a cluster. This way, all nodes in the cluster can be tested. The Advanced Settings button becomes available only when the destination database instance is a PolarDB for MySQL cluster and the Benchmark Data Migration parameter is set to Data Migration Completed.
      Privileged Account of Source Instance The password of the privileged account for the source instance.
    4. In the Stress Testing Basic Settings section, configure the parameters that are described in the following table.
      Parameter Description
      Select Playback Traffic Specify a time range within which the traffic is replayed.
      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 value of the playback rate must be a positive integer. Valid values: 1 to 30.
      Note If 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.
    5. In the Advanced Settings section, set 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. The recommended version of the client is Java 8.
  5. Click OK.
    w
  6. After the stress testing task is created, you can view the information about the stress testing task on the Task Center page.
    ll
  7. In the Actions column, you can perform the following operations:
    • Click Details to view the status and the report of the stress testing task on the Intelligent Stress Testing Details page. The following table describes the parameters.
      Parameter Description
      Overview You can compare the basic information that are collected from the source database instance and the destination database instance.
      Performance Trend Comparison You can compare the performance metrics that are collected from the source database instance and the destination database instance.
      SQL Comparison If DAS Professional Edition is purchased for the destination database 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 database instance and the destination database instance.
      Note You 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 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.
    ll
    Note If you do not need to perform stress testing again, on the Intelligent Stress Testing Details page you can release the ECS instance that is created to run the stress testing task.

Video tutorial

Related API operations