Database Autonomy Service (DAS) provides the automatic performance scaling feature for CPU specifications of database instances. DAS can automatically scale up your database instance to handle traffic spikes during peak hours and ensure the stability of your business. DAS monitors the CPU utilization of your database instance in real time. If the CPU utilization decreases within a specified observation window, DAS automatically scales down the database instance. This topic describes how to enable the automatic performance scaling feature.

Prerequisites

  • The database instance that you want to manage is of one of the following types:
    • ApsaraDB RDS for MySQL High-availability Edition instances that use standard SSDs or enhanced SSDs (ESSDs) or general-purpose ApsaraDB RDS for MySQL Enterprise Edition instances
    • PolarDB for MySQL Cluster Edition clusters
    Note The automatic performance scaling feature is not supported for ApsaraDB RDS for MySQL instances whose instance types are phased out. If the instance type of your ApsaraDB RDS for MySQL instance is phased out, you must change the instance type before you can enable the automatic performance scaling feature. For information about how to change the instance type of an ApsaraDB RDS for MySQL instance, see Change the specifications of an ApsaraDB RDS for MySQL instance.
  • The autonomy service is enabled for the database instance. For more information, see Autonomy center.
  • The balance in your Alibaba Cloud account is sufficient to pay for the resources required to scale up the CPU specification of your database instance.
  • A DAS-linked role is created. For more information, see AliyunServiceRoleForDAS role.
    Note If you have not created a RAM role that is linked to DAS, DAS can automatically create a service-linked role when you enable the automatic performance scaling feature.

Process of automatic scaling

Flowchart

Automatic scaling

After you enable the automatic scaling feature for your database instance, DAS performs automatic scaling based on the database instance type when the average CPU utilization of the database instance over an observation window reaches the specified threshold.
  • For an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard SSDs or ESSDs or a PolarDB for MySQL Cluster Edition cluster:

    DAS automatically selects a specification within the specified range to scale up the database instance based on the current instance workload. After the database instance is scaled up, DAS monitors the CPU utilization of the database instance. If the CPU utilization exceeds the specified threshold again, DAS scales up the database instance again. This process is repeated until the CPU specification of the database instance is scaled up to the maximum specification that you specified.

  • For a general-purpose ApsaraDB RDS for MySQL Enterprise Edition instance:
    DAS increases the number of CPU cores by two times the original number. For example, if the original number of CPU cores is 4, the number of CPU cores becomes 8 after a scale-up. The IOPS of the database instance also increases. The IOPS increases by 1,000 for every CPU core added. If the CPU resources in the host are insufficient, scale-up operations are not triggered.
    Note DAS increases the number of CPU cores only to two times the original number, but cannot further increase the number. For example, after the number of CPU cores is increased to 8, it cannot be further increased to 16.

Automatic scale-down

  • For an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard SSDs or ESSDs or a PolarDB for MySQL Cluster Edition cluster:

    After you select Auto Scale-down/in, if the CPU utilization of your database instance is lower than 30% for longer than 99% of a quiescent period, automatic scale-down is triggered after the quiescent period ends. The specifications of the database instance are scaled down to the original specifications in small increments.

  • For a general-purpose ApsaraDB RDS for MySQL Enterprise Edition instance:

    If the CPU utilization of your database instance is lower than 30% for longer than 99% of a specified scale-down observation window, DAS scales the number of CPU cores and IOPS of the database instance back to the original specifications.

Note After you enable the automatic performance scaling feature for your database instance, DAS monitors the database instance based on the most recent parameter settings. When the database instance meets the conditions for automatic scale-up or scale-down, DAS scales up or down the instance.

Billing rules

  • For an ApsaraDB RDS for MySQL instance:
    • Enterprise Edition (general-purpose instance family): You are charged at an hourly rate based on the pay-as-you-go billing method.

      Price calculation formula: (Fee per CPU core × Number of CPU cores added) × Scale-up duration (minutes)

    • High-availability Edition with standard SSDs or ESSDs: You are charged based on the instance specifications after scale-up. The price for a scale-up varies based on the instance configurations, such as the region and the new instance type. For more information, visit the ApsaraDB RDS buy page.
  • For a PolarDB for MySQL cluster:

    For information about the pricing rules, see Configuration change fees.

Scenarios

After you enable the automatic performance scaling feature for a database instance, DAS automatically scales up the database instance during peak hours. This can double the read/write throughput and lower the CPU utilization from higher than 90% to 25%. The database instance can run under a heavy load for approximately 10 hours. After the traffic decreases and the CPU utilization drops to lower than 25%, DAS scales the database instance back to the original specifications.

This way, DAS can manage your database instance to handle traffic spikes during peak hours and help ensure the stability of your business.

Impacts

  • For an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard SSDs or ESSDs or a PolarDB for MySQL Cluster Edition cluster, a 30-second transient connection may occur when your database instance is scaled up or scaled down. Make sure that your application can automatically reconnect to the database instance.
  • For a PolarDB for MySQL Cluster Edition cluster, DAS upgrades or downgrades only the specifications of the entire cluster instead of the specifications of a single node in the cluster.
  • If the database engine of the database instance is not of the latest version, DAS updates the database instance to run the database engine of the latest version when DAS scales up the database instance. This ensures the performance and stability of your database instance.
  • The scaling operation is performed only on the primary instance. If primary/secondary switchover is triggered after the primary instance is scaled, one of the following situations occurs:
    • If the primary instance (original secondary instance) meets the specified trigger conditions for scale-up and scale-down, DAS performs the scaling operation on the primary instance.
    • If the secondary instance (original primary instance) meets the specified trigger conditions for scale-down, DAS scales the secondary instance back to its original specifications.

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring.
  3. On the page that appears, find the database instance for which you want to enable the automatic performance scaling feature and click the instance ID. The instance details page appears.
  4. In the left-side navigation pane, click Autonomy Center.
  5. In the upper-right corner of the Autonomy Center page, click Autonomy Service Settings.
    Autonomy Service Settings
  6. On the Autonomous Function Settings tab of the Autonomous Function Management panel, enable the autonomy service. Then, on the Optimization and Throttling tab, configure the parameters described in the following tables.
    • For an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard or enhanced SSDs, enable automatic performance scaling. For a general-purpose ApsaraDB RDS for MySQL Enterprise Edition instance, enable Automatic Resource Elasticity and configure the following parameters.
      Instance TypeKeywordFeature
      General-purpose instanceCPU Utilization ≥ The threshold based on which automatic scale-up is triggered. If the average CPU utilization is greater than or equal to the specified value, automatic scale-out is triggered.
      High-availability Edition instance that uses standard SSDs or ESSDsObservation WindowThe time range during which you want to observe the performance of the database instance. DAS checks the average CPU utilization of the database instance within an observation window at specific intervals. If the average CPU utilization reaches the specified threshold, automatic scale-up is triggered.
      Maximum SpecificationsThe maximum specifications to which DAS can upgrade the database instance. If the CPU utilization of the database instance reaches the specified threshold, DAS scales up the database instance. If the CPU utilization of the database instance reaches the specified threshold again during the next observation window, DAS scales up the database instance again. This process is repeated until the database instance is scaled up to the maximum specifications that you specified.
      Automatic Scale-down/inAfter you select Auto Scale-down/in, if the CPU utilization of your database instance is lower than 30% for longer than 99% of a quiescent period, automatic scale-down is triggered after the quiescent period ends. The specifications of the database instance are scaled down to the original specifications in small increments.
      Quiescent PeriodThe minimum interval between two automatic scale-up operations or two automatic scale-down operations. During a quiescent period, DAS monitors the CPU utilization of the database instance, but does not trigger automatic scale-up or scale-down even if the specified conditions are met. If a quiescent period and an observation window end at the same time and the average CPU utilization within the observation window reaches the specified threshold, DAS automatically triggers a scale-up or scale-down.
      General-purpose Enterprise Edition instanceScale-up Observation WindowThe time range during which you want to observe the scale-up performance of the database instance. DAS checks the average CPU utilization of the database instance within an observation window at specific intervals. If the average CPU utilization reaches the specified threshold, automatic scale-up is triggered.
      Scale-back Observation WindowThe time range during which you want to observe the scale-down performance of the database instance. DAS checks the CPU utilization of the database instance within an observation window at specific intervals. If the CPU utilization is lower than 30% for longer than 99% of the observation window, automatic scale-down is triggered.
    • For a PolarDB for MySQL cluster, select Automatic Scale-up/out and Automatic Scale-down/in and configure the parameters described in the following table.
      Important
      • After you select Automatic Scale-up/out, if the CPU utilization of the cluster is greater than or equal to the specified threshold within an observation window, DAS automatically scales up the PolarDB cluster based on the workloads on the cluster after the observation window ends. For example, the specified threshold is 70%, the specified observation window is 5 minutes, and the specified time required to complete automatic scaling is 10 minutes. If the CPU utilization of a single node in a cluster exceeds 70% within the observation window, DAS automatically scales up the cluster. DAS automatically scales out or up the cluster based on the real-time read and write traffic. By default, when the read traffic exceeds the write traffic, DAS automatically adds nodes to the cluster. Otherwise, DAS automatically upgrades the specifications of the cluster. If the workloads on the primary node of the cluster is high, DAS automatically upgrades the specifications of the cluster.
      • After you select Auto Scaling-in, if the CPU utilization remains at less than 30% for more than 99% of the silent period, an automatic scale-in activity is triggered after the silent period ends. The specifications of the PolarDB for MySQL cluster are scaled back to the original specifications in small increments. Nodes that are added during scale-out are reduced one by one during scale-in. The cluster that is upgraded during scale-up is downgraded during scale-down. Note that for a PolarDB for MySQL Cluster Edition cluster, DAS upgrades or downgrades only the specifications of the entire cluster instead of the specifications of a single node in the cluster.
      The name of the parameter.Parameters
      Average CPU Utilization ≥The threshold based on which automatic scale-up is triggered. If the average CPU utilization is greater than or equal to the specified value, automatic scale-out is triggered.
      Maximum SpecificationsThe maximum specifications to which DAS can upgrade the cluster. After automatic scale-up is triggered, DAS scales up your PolarDB cluster to the maximum specifications in small increments. For example, the CPU specification can be upgraded from 4 cores to 8 cores, and then to 16 cores until the upper limit is reached.
      Max number of Read-Only nodesThe maximum number of read-only nodes that the cluster can contain. After automatic scale-up is triggered, read-only nodes are automatically added to the PolarDB cluster one by one until the upper limit is reached.
      Note The nodes that are automatically added are associated with the default endpoint of your cluster. If you use a custom endpoint, you must specify whether these nodes are automatically associated with the endpoint by using the Automatically Associate New Nodes parameter. For more information about how to configure Automatically Associate New Nodes, see Configure Polar Proxy.
      Observation WindowIf the average CPU utilization reaches or exceeds the specified threshold within the observation window, DAS automatically scales out or up the cluster after the observation window ends. This ensures that the cluster can handle all read and write requests. For example, if the length of the observation window is 5 minutes and the time required to complete a scaling activity is 10 minutes, you must wait 15 minutes before you can check the scaling result.
      Quiescent PeriodThe minimum interval between two automatic scale-up operations or two automatic scale-down operations. During a quiescent period, DAS monitors the CPU utilization of the database instance, but does not trigger automatic scale-up or scale-down even if the specified conditions are met. If a quiescent period and an observation window end at the same time and the average CPU utilization within the observation window reaches the specified threshold, DAS automatically triggers a scale-up or scale-down.
  7. Click OK.

Best practices

Troubleshoot high CPU utilization