All Products
Search
Document Center

PolarDB:Auto scaling

更新時間:Jul 09, 2024

You can use the auto scaling feature to scale a cluster for which the serverless feature cannot be enabled, such as a PolarDB for MySQL 5.6 cluster. You can configure auto scaling parameters on the Basic Information page of a cluster in the PolarDB console. The cluster is automatically scaled based on the specified configurations. This topic describes how to configure auto scaling parameters.

Background information

Auto scaling takes effect in at least 15 minutes. We recommend that you do not use the auto scaling feature for business that has a short peak duration. If you do not want the system to roll back your cluster after a scale-out, you can disable auto scale-in. PolarDB for MySQL provides the following configuration change methods: manual configuration change, temporary upgrade, auto scaling, and DAS-based scaling. You can select a method based on your business requirements.

  • Manual configuration change: If your cluster has a stable workload, you can manually change the cluster specifications based on your business requirements. For more information, see Manually upgrade or downgrade a PolarDB cluster.

  • Temporary upgrade: This method is suitable for upgrade during peak hours. For more information, see Perform a temporary cluster upgrade.

  • Auto scaling: The system can automatically scale your clusters based on your business workloads. Do not use this method is the business peak duration is less than 15 minutes.

  • DAS-based scaling: If your business frequently experiences drastic fluctuations, we recommend that you use the auto scaling feature provided by Database Autonomy Service (DAS). For more information, see Configure the auto scaling feature of DAS.

Prerequisites

  • Your cluster runs PolarDB for 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 about the serverless feature, see Overview.

  • Your cluster is a PolarDB for MySQL Cluster Edition cluster. This feature is unavailable for a Multi-master Cluster (Database/Table). For more information about the two cluster editions, see Editions.

  • No cluster configuration change tasks are being performed in the PolarDB cluster.

Billing

PolarDB for MySQL clusters that use the pay-as-you-go and subscription billing methods support the auto scaling feature.

Pay-as-you-go

Pay-as-you-go clusters are charged on an hourly basis. After you change the configurations of a pay-as-you-go cluster, the cluster is charged based on the new price per hour.

Subscription

Change type

Description

Upgrade specifications or add nodes

Payment = Total fees of the new configuration for the remaining subscription period (Monthly price of the new configuration/30/24 × Remaining subscription period measured in hours) - Total fees of the original configuration for the remaining subscription period (Monthly price of the original configuration/30/24 × Remaining subscription period measured in hours)

Example: The monthly price of the new specifications is USD 14,400. The monthly price of the original specifications is USD 7,200. The remaining subscription duration is 50 days. The fee for the specification upgrade is calculated by using the following formula: (14,400/30/24 × 50 × 24) - (7,200/30/24 × 50 × 24) = USD 12,000.

Downgrade specifications or delete nodes

Refund = Total fees of the original configuration for the remaining subscription period (Monthly price of the original configuration/30/24 × Remaining subscription period measured in hours) - Total fees of the new configuration for the remaining subscription period (Monthly price of the new configuration/30/24 × Remaining subscription period measured in hours).

For example, to purchase a subscription cluster for three months, you are charged USD 3,500. You pay USD 3,000 for the cluster after you use coupons. After two months, the total fees of the original configuration for the remaining subscription period become USD 1,000. The total fees of the new configuration for a month are USD 800. The refund is calculated by using the following formula: USD 1,000 - USD 800 = USD 200.

Note

You can apply for a refund for a downgraded configuration of a subscription cluster. However, you cannot apply for a refund for the fees for the entire cluster. If you want to apply for a refund for the entire cluster,

Submit a ticket. If your application is approved, your subscription cluster is frozen and automatically deleted after 14 days.

The billing rules for manual scaling and automatic scaling are the same. For more information, see Configuration change fees.

Refunds for cluster downgrade

When the specifications of a subscription cluster exceed your business requirements and your account has the configuration downgrade privilege, you can downgrade the configurations of the cluster in real time. For more information about the refund policy, see

Rules for unsubscribing from resources.

Limits

  • You can upgrade or downgrade only clusters. You cannot upgrade or downgrade a single node in a cluster.

  • When you upgrade or downgrade a cluster, data stored in the cluster is not affected.

  • During the upgrade or downgrade process, your applications are temporarily disconnected from the cluster for no more than 30 seconds. We recommend that you upgrade or downgrade your cluster during off-peak hours and make sure that your applications are configured with the automatic reconnection mechanism.

  • A cluster scale-out or scale-in has minor impacts on the primary node of a PolarDB cluster. However, the scale-out or scale-in 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 scale-out or scale-in process.

Procedure

  1. Log on to the PolarDB console.

  2. In the upper-left corner, select the region where the cluster to which you want to connect is deployed.

  3. On the Clusters page, find the cluster that you want to manage and click the cluster ID.

  4. On the Basic Information page, click Settings in the upper-right corner of the Database Nodes section.

    设置

  5. 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.

    Note

    The 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.

    Note
    • The 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.

    Note

    After 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.

    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.

  6. Click OK.

You can disable auto scaling at any time. If the cluster has been automatically scaled up/out but has not been scaled back when you disable auto scaling, the cluster is not scaled back to its original configurations.