PolarDB for MySQL provides the auto scaling feature to handle traffic spikes and ensure cluster stability. With this feature enabled, a cluster is scaled based on average CPU utilization and read/write traffic. Also, auto scale-back is supported to change the cluster specifications back during off-peak hours.
This feature is supported only for PolarDB MySQL 5.6. Other versions of PolarDB for MySQL clusters support the serverless feature and can be automatically scaled after the serverless feature is enabled. For more information, see Enable the serverless feature for a cluster with defined specifications.
Prerequisites
Your cluster runs PolarDB for MySQL 5.6.
No cluster configuration change tasks are being performed in the PolarDB cluster.
Limits
Auto scaling takes effect in at least 15 minutes. Do not use the feature for business that has a short peak duration. If you do not want the system to scale back your cluster after a scale-out, you can disable auto scale-in. You cannot enable auto scale-in without enabling auto scale-out. If both features are enabled, the system automatically scales your clusters based on your business workloads.
You can upgrade or downgrade only an entire cluster, not a single node in a cluster.
During the upgrade or downgrade process, your applications are temporarily disconnected from the cluster for no more than 30 seconds. Make sure that your applications are configured with the automatic reconnection mechanism.
Auto scaling degrades the performance of read-only nodes in the cluster. As a result, the read-only nodes require more time to handle requests during the scaling process.
When you upgrade or downgrade a cluster, data stored in the cluster is not affected.
Billing
The system calculates the scaling fees based on the billing method of the cluster and the changes. For more information, see Change the configurations.
Billing method | Billing rules |
Pay-as-you-go | You are charged for pay-as-you-go clusters by hour. After you change the configurations of a pay-as-you-go cluster, you are charged for the cluster on an hourly basis based on the price of the new configurations. |
Subscription | Payment = Total fee of the new configuration for the remaining subscription period (Monthly price of the new configuration/30/24 × Unused hours) - Total fee of the original configuration for the remaining subscription period (Monthly price of the original configuration/30/24 × Unused hours). For example, the monthly price of the new configuration is USD 14,400, the monthly price of the original configuration is USD 7,200, and the remaining subscription period is 50 days. The payment is calculated by using the following formula: (USD 14,400/30/24 × 50 × 24) - (USD 7,200/30/24 × 50 × 24) = USD 12,000. |
Procedure
Log on to the PolarDB console. Click Clusters in the left-side navigation pane. Select a region in the upper-left corner and click the ID of the cluster in the list to go to the Basic Information page.
On the Basic Information page, click Settings in the upper-right corner of the Database Nodes section.
In the dialog box that appears, configure the following parameters. The following table describes the parameters.
Parameter
Description
Auto Scaling-out
Specifies whether to enable the auto scaling feature.
Observation Period
If the CPU utilization reaches the specified threshold during the observation period, PolarDB automatically adds nodes or upgrades the specifications of your cluster when the observation period ends. The system determines the scaling method based on the inbound read and write requests. The minimum observation period is 5 minutes, and the time required to complete a scaling activity is 10 minutes. Therefore, auto scaling requires at least 15 minutes to take effect. For example, if the observation period 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.
NoteThe scale-in observation window is equal to the observation window plus 10 minutes. For example, if the observation window is set to 30 minutes, the scale-in observation window is 40 minutes.
CPU Usage
The threshold that is used to trigger automatic scale-up. If the CPU Usage is greater than or equal to the specified threshold, automatic scale-up is triggered.
Maximum Specification
The maximum specifications to which the system can upgrade the cluster. After an automatic scale-up is triggered, the system 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.
Maximum Number of Read-only Nodes
The maximum number of read-only nodes that can be automatically added to the cluster. After an auto scaling is triggered, the system adds one or two read-only nodes each time until the specified upper limit is reached.
NoteThe nodes that are automatically added are associated with the default endpoint of your cluster. If you use a custom endpoint, 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 the Automatically Associate New Nodes parameter, see Configure PolarProxy.
If you want the system to perform only scale-up and no scale-out, set this parameter to the current number of read-only nodes of the cluster.
During a scale-up, transient disconnections occur on all nodes of the cluster. This does not occur during a scale-out.
Auto Scaling-in
Specifies whether to enable automatic scale-back.
NoteAfter automatic scale-back is enabled, if the cluster is not in the quiescent period and the average CPU utilization of automatically scaled nodes remains at less than 30% for more than 99% of the scale-in observation window (the observation window plus 10 minutes), the cluster is scaled back tier-by-tier to the original specifications.
A scaled cluster is not automatically scaled back after you disable the auto scaling feature.
Quiescent Period
The minimum interval between two scaling activities. During a quiescent period, PolarDB monitors the resource usage of a cluster but does not trigger scaling activities. If a quiescent period and an observation period end at the same time and the CPU utilization reaches the threshold within the observation period, PolarDB automatically triggers auto scaling.