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.
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.
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:
Automatic scaling for local resources
Automatic configuration changes for PolarDB clusters
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.
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.
Log on to the DAS console.
In the left-side navigation pane, click Management and Settings.
In the Auto Scaling Policies section, click Add Policy.
In the Add Policy panel, configure the following parameters.
The name of the policy.
The mode of the policy. Select Automatic Scaling for Local Resources.
The type of the database engine. Only PolarDB for MySQL is supported.
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.
Click Next Step.
On the Auto Scaling Policies page, find the policy you created and click Apply in the Actions column.
In the Apply Policies dialog box, select the database instances to which you want to apply the policy, and click .
Click Confirm. Then, the policy is applied to the selected database instances.
View the results of automatic scaling for local resources
In the left-side navigation pane of the DAS console, click Instance Monitoring.
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.
In the left-side navigation pane, click Autonomy Center.
On the Autonomy Center page, select a time range and filter the auto scaling events that occurred in the selected time range.
Click Details in the Auto-Scaling Events section to view the details of auto scaling events.