All Products
Search
Document Center

PolarDB:Automatically scale local resources

Last Updated:Jul 26, 2023

PolarDB for MySQL allows you to scale local resources within several seconds. When the average CPU utilization of a PolarDB cluster within a sampling duration reaches the specified threshold, PolarDB for MySQL increases the number of CPU cores of the cluster to the specified value.

Prerequisites

  • Only standard PolarDB for MySQL clusters of the Cluster Edition support this feature.

  • To use this feature, you must create an AliyunServiceRoleForDAS role in the Database Autonomy Service (DAS) console. For more information, see AliyunServiceRoleForDAS role.

Usage notes

  • This feature is provided free of charge.

  • If you want to enable automatic scaling for local resources, we recommend that you disable automatic configuration changes for PolarDB clusters. These two features are not compatible with each other. If you enable automatic configuration changes for PolarDB clusters when automatic scaling for local resources is enabled, automatic scaling for local resources will fail.

Comparison between automatic scaling for local resources and automatic configuration changes for PolarDB clusters

The following table describes the differences between automatic scaling for local resources and Automatic configuration changes (auto scaling) for PolarDB clusters:

Item

Automatic scaling for local resources

Automatic configuration changes for PolarDB clusters

Scalable resources

You can scale only CPU cores and IOPS, but cannot scale memory and connections.

You can scale CPU cores, IOPS, memory, and connections at the same time.

Scaling speed

Quick scaling:

  • The minimum sampling duration is 30 seconds.

  • When a scale-up task is triggered, it can be completed within several seconds.

Slow scaling:

  • The minimum sampling duration is 5 minutes.

  • Scaling takes a longer time because the specifications of the cluster are changed.

Scaling process

No network interruptions occur during the scaling process because specification changes are not required.

Network interruptions occur because specification changes are required.

Based on the preceding comparison, automatic scaling for local resources has the following advantages:

  • A scale-up task can be completed within several seconds.

  • No network interruptions occur during the scaling process.

Procedure

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Management and Settings.

  3. In the Auto Scaling Policies section, click Add Policy.

  4. In the Add Policy panel, configure the following parameters.

    Parameter

    Description

    Policy Name

    The name of the policy.

    Mode

    The mode of the policy. Select Automatic Scaling for Local Resources.

    Engine Type

    The type of the database engine. Only PolarDB for MySQL is supported.

    Specifications

    The specifications of the selected database engine. Only General-purpose Cluster is supported.

    Average CPU Utilization

    The threshold that is used to trigger automatic scale-up. If the average CPU utilization is greater than or equal to the specified value, automatic scale-up is triggered.

    Scale-up Observation Window

    The sampling duration for scale-up. DAS monitors the CPU utilization of the instance during the sampling duration. When the CPU utilization reaches the value specified in the Average CPU Utilization parameter, a scale-up task is triggered.

    CPU Scale-up Step Size

    The number of cores to add during each CPU scale-up. The value must be an integer ranging from 2 to 31.

    For example, if the number of CPU cores of an instance is 4 and the CPU Scale-up Step Size value is 2, the number of CPU cores is increased to 6 after a CPU scale-up. If the average CPU utilization still meets the conditions for triggering automatic scale-up after a scale-up is complete, another scale-up is performed until the maximum number of CPU cores is reached.

    Note

    The maximum number of CPU cores for a single database instance is 32, which is calculated based on the following formula: 4 × Original number of CPU cores.

    For example, if the original number of CPU cores of an instance is 4, the CPU of the instance can be scaled up to a maximum of 16 cores.

    Scale-down Observation Window

    The sampling duration for scale-down. DAS monitors the CPU utilization of the instance during the sampling duration. When the CPU utilization is below 30% for more than 99% of the sampling duration, a scale-down task is triggered.

    The number of CPU cores is decremented by the CPU Scale-up Step Size value during each scale-down until the number of CPU cores return to the original value.

  5. Click Next Step.

  6. On the Auto Scaling Policies page, find the policy you created and click Apply in the Actions column.

  7. In the Apply Policies dialog box, select the database instances to which you want to apply the policy, and click xy.

    Apply the policy
  8. Click Confirm. Then, the policy is applied to the selected database instances.

View the results of automatic scaling for local resources

  1. In the left-side navigation pane of the DAS console, click Instance Monitoring.

  2. On the page that appears, find the database instance for which you want to enable the auto scaling feature and click the instance ID. The instance details page appears.

  3. In the left-side navigation pane, click Autonomy Center.

  4. On the Autonomy Center page, select a time range and filter the auto scaling events that occurred in the selected time range.

  5. Click Details in the Auto-Scaling Events section to view the details of auto scaling events.

    p2022021701