All Products
Search
Document Center

Database Autonomy Service:Automatic performance scaling

更新時間:Dec 20, 2024

As your business expands, data volume increases, and new services or features are released, the requests to access databases increase and computing resources become insufficient. To resolve these issues, you can scale up your database instances by increasing CPU cores and memory capacities. Database Autonomy Service (DAS) provides the automatic performance scaling feature that can scale up database instances to handle traffic during peak hours. When traffic decreases, DAS automatically scales down the database instances to prevent resource waste.

Prerequisites

  • The database instance that you want to manage is of one of the types described in the following table.

    Database instance

    Region

    • General-purpose and dedicated ApsaraDB RDS for MySQL High-availability Edition instances that use standard SSDs or Enterprise SSDs (ESSDs), general-purpose ApsaraDB RDS for MySQL High-availability Edition instances that use local disks, and general-purpose ApsaraDB RDS for MySQL Enterprise Edition instances

    • PolarDB for MySQL Cluster Edition clusters

    The automatic performance scaling feature depends on the anomaly detection feature. You can enable the automatic performance scaling feature only for database instances in regions that support the anomaly detection feature. The anomaly detection feature is supported in the following regions:

    China (Hangzhou), China (Shanghai), China (Shenzhen), China (Heyuan), China (Guangzhou), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Nanjing - Local Region), China (Fuzhou - Local Region), China (Chengdu), China (Zhengzhou - Local Region), China (Hong Kong), Japan (Tokyo), South Korea (Seoul), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Philippines (Manila), Thailand (Bangkok), Australia (Sydney) Closing Down, UAE (Dubai), SAU (Riyadh - Partner Region), Germany (Frankfurt), US (Silicon Valley), US (Virginia), and UK (London)

    Note
    • The automatic performance scaling feature is not supported for ApsaraDB RDS for MySQL instances whose instance types are discontinued. If the instance type of your ApsaraDB RDS for MySQL instance is discontinued, you must change the instance type of the instance before you enable the automatic performance scaling feature for the instance. For more information about how to change the instance type of an ApsaraDB RDS for MySQL instance, see Change instance specifications.

  • The balance of your Alibaba Cloud account is sufficient to pay for the resources that are required to scale up your database instance.

  • A service-linked role is created for DAS. For more information, see AliyunServiceRoleForDAS role.

    Note

    If the service-linked role for DAS is not created, the system automatically creates the role before automatic performance scaling starts.

Process of automatic performance scaling

云盘扩容流程

Automatic scale-up

After you enable the automatic scale-up feature for your instance, DAS automatically scales up your database instance based on the average CPU utilization of the database instance in an observation window.

Important

After a database instance is scaled up, extreme scenarios may occur, such as failover, a serious shortage of host resources, and resource reallocation due to conflicts with existing control processes. We recommend that you use the automatic scaling feature to evaluate the peak CPU utilization for core instances in the short term and upgrade the specifications of core instances based on the peak CPU utilization in the long term.

  • 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 specifications within the specified range to scale up the database instance based on the current workloads on the instance. 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 database instance is scaled up to the maximum specifications that you specified.

  • For a general-purpose ApsaraDB RDS for MySQL High-availability Edition instance that uses local disks or 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 instance also increases. The IOPS increases by 1,000 for each CPU core added. If the CPU resources on the host are insufficient, scale-ups are not triggered.

    Note

    DAS increases the number of CPU cores only to two times the original number. After that, DAS cannot further increase the number of CPU cores. For example, after the number of CPU cores is increased to 8, DAS cannot further increase the number to 16.

Automatic scale-down

Important

If an automatic scale-up is performed after the automatic scale-down feature is enabled, the system automatically rolls back the instance specifications to the original specifications in small decrements. This applies if specific requirements are met. However, if an automatic scale-up is performed before the automatic scale-down feature is enabled, the system does not roll back the instance specifications to the original specifications even after the automatic scale-down feature is enabled.

  • 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 enable the Automatic Scale-down/in feature for your database instance, if the CPU utilization of your database instance is lower than 30% for longer than 99% of a scale-down observation window, an automatic scale-down is triggered after the Quiescent Period elapses. The database instance is scaled down to the original specifications in small decrements.

    Important
    • The duration of a scale-down observation window equals the duration of an observation window plus 10 minutes. For example, if you set the duration of an Observation Window to 30 minutes, the duration of a scale-down observation window is 40 minutes.

    • For an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard SSDs or ESSDs, the automatic scale-down feature is supported only by instances whose kindCode parameter is set to 18. You can call an API operation to query the value of the kindCode parameter. For more information, see DescribeDBInstanceAttribute.

  • For a general-purpose ApsaraDB RDS for MySQL High-availability Edition instance that uses local disks or 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 scale-down observation window, DAS decreases 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 scaling, DAS scales up or down the database instance.

For more information about the automatic performance scaling feature, see Auto Scaling.

Billing

  • For an ApsaraDB RDS for MySQL instance:

    • General-purpose High-availability Edition instance that uses local disks or general-purpose Enterprise Edition instance: You are charged based on the pay-as-you-go billing method, and fees are deducted once every hour.

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

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

  • For a PolarDB for MySQL cluster:

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

Example

After you enable the automatic performance scaling feature for a database instance, DAS automatically scales up the database instance during peak hours. This doubles the read/write throughput and lowers 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 manages your database instance to handle traffic spikes during peak hours and ensures 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 transient connection that lasts approximately 30 seconds may occur when your database instance is being scaled up or scaled down. In this case, make sure that your application is configured to 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 those of a single node in the cluster.

  • If the database engine of your database instance is not of the latest minor version, DAS updates the database instance to run the database engine of the latest minor 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 cases occurs:

    • If the primary instance (original secondary instance) meets the specified trigger conditions for a scale-up or scale-down, DAS performs the scaling operation on the primary instance (original secondary instance).

    • If the secondary instance (original primary instance) meets the specified trigger conditions for a scale-down, DAS scales the secondary instance (original primary 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 that you want to manage 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.

  6. On the Autonomous Function Settings tab of the Autonomous Function Management panel, enable the autonomy service.

  7. On the Optimization and Throttling tab, configure the parameters.

    • Select Automatic Performance Scaling for an ApsaraDB RDS for MySQL instance or an ApsaraDB RDS for MySQL High-availability Edition instance that uses standard SSDs or ESSDs. Select Automatic Resource Elasticity for a general-purpose ApsaraDB RDS for MySQL High-availability Edition instance that uses local disks or a general-purpose ApsaraDB RDS for MySQL Enterprise Edition instance. Then, configure the parameters that are described in the following table.

      Instance type

      Parameter

      Description

      General-purpose instance

      CPU Utilization ≥

      The threshold based on which an automatic scale-up is triggered. If the average CPU utilization is greater than or equal to the specified value, an automatic scale-up is triggered.

      High-availability Edition instance that uses standard SSDs or ESSDs

      Observation Window

      The time range during which the performance of the database instance is observed. DAS checks the average CPU utilization of the database instance during an observation window at specific intervals. If the CPU utilization reaches the specified threshold, an automatic scale-up is triggered.

      Important

      The duration of a scale-down observation window equals the duration of an observation window plus 10 minutes. For example, if you set the duration of an Observation Window to 30 minutes, the duration of a scale-down observation window is 40 minutes.

      Maximum Specifications

      The maximum specifications to which the database instance can be scaled up. 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.

      Important

      If the RDS instance uses an instance type that provides 1 CPU core and 2 GB of memory and an automatic scale-up is triggered, the specifications of the RDS instance are upgraded to 4 CPU cores and 8 GB of memory. In this case, you must set the maximum specifications to at least 4 CPU cores and 8 GB of memory. Otherwise, the automatic scale-up fails.

      Automatic Scale-down/in

      After you select Automatic Scale-down/in, if the CPU utilization of your database instance is lower than 30% for longer than 99% of a scale-down observation window, an automatic scale-down is triggered after the Quiescent Period elapses. The specifications of the database instance are scaled down to the original specifications in small decrements. The duration of a scale-down observation window equals the duration of an observation window plus 10 minutes.

      Quiescent Period

      The minimum interval between two consecutive automatic scale-in operations or two scale-out operations. During a quiescent period, DAS monitors the CPU utilization of the instance, but does not trigger automatic scale-ups or scale-downs 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 ApsaraDB RDS for MySQL High-availability Edition instance that uses local disks and general-purpose ApsaraDB RDS for MySQL Enterprise Edition instance

      Scale-up Observation Window

      The CPU utilization observation window for a scale-up. DAS checks the average CPU utilization of the database instance during an observation window at specific intervals. If the average CPU utilization reaches the specified threshold, automatic scale-up is triggered.

      Scale-back Observation Window

      The CPU utilization observation window for a scale-down. 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 scale-down observation window, an 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 that are 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 duration of an observation window is 5 minutes, and the specified amount of time required to complete an automatic scaling operation is 10 minutes. If the CPU utilization of a single node in the 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, if the read traffic exceeds the write traffic, DAS automatically adds read-only nodes to the cluster. If the write traffic exceeds the read traffic, DAS automatically upgrades the specifications of the cluster. If the workloads on the primary node of the cluster are high, DAS automatically upgrades the specifications of the cluster.

      • After you select Automatic Scale-down/in, if the CPU utilization of the cluster is lower than 30% for longer than 99% of a scale-down observation window, an automatic scale-down is triggered after the quiescent period ends. The specifications of the cluster are scaled down to the original specifications in small decrements. The duration of a scale-down observation window equals the duration of an observation window plus 10 minutes. Read-only nodes that are added during a scale-up of the cluster are removed one by one during a scale-down of the cluster. The cluster that is upgraded during a scale-up is downgraded during a scale-down. For a PolarDB for MySQL Cluster Edition cluster, DAS upgrades or downgrades only the specifications of the entire cluster instead of those of a single node in the cluster.

      Parameter

      Description

      Average CPU Utilization ≥

      The threshold based on which an automatic scale-up is triggered. If the average CPU utilization is greater than or equal to the specified value, an automatic scale-up is triggered.

      Maximum Specifications

      The maximum specifications to which the cluster can be scaled up. After an automatic scale-up is triggered, the system scales up your PolarDB for MySQL cluster to the maximum specification 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 nodes

      The maximum number of read-only nodes that the cluster can contain. After an automatic scale-up is triggered, one or two read-only nodes are automatically added to the PolarDB for MySQL cluster based on your business requirements 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 to automatically associate these nodes with the endpoint by configuring the Automatically Associate New Nodes parameter. For more information about how to set the Automatically Associate New Nodes parameter, see Configure PolarProxy.

      Observation Window

      If the average CPU utilization reaches or exceeds the specified threshold within an observation window, DAS automatically scales up the cluster after the observation window ends. This ensures that the cluster can handle all read and write requests. For example, if the specified duration of an observation window is 5 minutes and the specified amount of time required to complete an automatic scaling operation is 10 minutes, you must wait 15 minutes before you can check the scaling results.

      Important

      The duration of a scale-down observation window equals the duration of an observation window plus 10 minutes. For example, if you set the duration of an observation window to 30 minutes, the duration of a scale-down observation window is 40 minutes.

      Quiescent Period

      The minimum interval between two consecutive automatic scale-ups or two automatic scale-downs. During a quiescent period, DAS monitors the CPU utilization of the cluster, but does not trigger automatic scale-ups or scale-downs 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.

  8. Click OK.

FAQ

What do I do if the specifications of a database instance have reached the upper limit?

We recommend that you purchase a database instance that runs a higher edition. For example, the maximum specifications of an ApsaraDB RDS for MySQL instance that runs High-availability Edition and uses a dedicated instance type are 104 CPU cores and 768 GB of memory. Then, migrate your instance data to the new instance. For more information about the specifications of database instances and data migration scenarios, see the following topics:

References

  • If your business traffic peak periodically occurs, you can enable the scheduled automatic scaling feature for your instance. The system scales up your instance based on a preset policy and automatically scales down the instance to the original instance specifications after the specified scale-out duration ends.

  • If your instance does not support the automatic performance scaling feature, you can manually change the instance specifications to scale out or scale in the instance. For more information, see the following topics: