All Products
Search
Document Center

Database Autonomy Service:Automatic scaling for local resources

Last Updated:Nov 12, 2024

Database Autonomy Service (DAS) supports automatic scaling for local resources. If the average CPU utilization of a database instance over an observation window reaches the specified threshold, DAS utilizes available resources on the local host to increase the number of CPU cores of the database instance to the specified value.

Prerequisites

  • The database instance for which you want to configure this feature is PolarDB for MySQL Cluster Edition of the general-purpose specification or Multi-master Cluster (Database/Table) Edition of the general-purpose specification.

    Note

    PolarDB for MySQL 8.0.2 does not support automatic scaling for local resources.

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

Benefits

Automatic scaling for local resources is implemented by removing the limits imposed by cgroups on local hosts. The following table describes the comparison between automatic scaling for local resources and automatic performance scaling.

Item

Automatic scaling for local resources

Automatic performance scaling

Scalable resources

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

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

Scaling speed

Fast

  • The minimum duration of a scale-up observation window is 30 seconds.

  • After a scale-up task is triggered, the scale-up task can be completed within seconds.

Slow

  • The minimum duration of a scale-up observation window is 5 minutes.

  • Scaling takes a longer period of time because specification scale-up is involved.

Scale-up process

No transient connections occur during the scale-up process because specification changes are not required.

Transient connections occur because specification changes are required.

Usage notes

  • This feature is in trial period and is available free of charge.

  • After automatic scaling for local resources is enabled for a database instance, we recommend that you disable automatic performance scaling for the database instance because the two features conflict with each other. For example, if automatic performance scaling is triggered after automatic scaling for local resources, automatic scaling for local resources becomes invalid.

    Note

    You can disable automatic performance scaling by performing the following steps: On the details page of a database instance, click Autonomy Service Settings in the upper-right corner. On the Autonomous Function Settings tab of the Autonomous Function Management panel, disable Auto Storage Expansion.

  • If the host on which a database instance resides does not have sufficient CPU resources, the instance is not scaled up.

  • After a database instance is scaled up, extreme scenarios may occur, such as failover, serious shortage of host resources, and resource deallocation due to conflicts with existing control processes. We recommend that you use the automatic scaling for local resources feature to measure 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.

Procedure

  1. Log on to the DAS console.

  2. Create an automatic scaling policy for local resources.

    • Create an automatic scaling policy for local resources on the Management and Settings page.

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

      2. In the Auto Scaling Policies section, click Add Policy. In the Add Policy panel, configure the parameters described in the following table.

        Table 1. 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.

        Average CPU Utilization

        The threshold that is used to trigger the automatic scaling. If the average CPU utilization of a node in a cluster reaches the specified value, the node is automatically scaled up.

        Scale-up Observation Window

        The time range during which you want to observe the performance of the instance for triggering automatic scale-up. DAS checks the CPU utilization of the instance during the scale-up observation window at specific intervals. When the CPU utilization reaches the value of the Average CPU Utilization parameter, automatic scale-up is triggered.

        CPU Scale-up Step Size

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

        For example, if the number of CPU cores of an instance is 4 and the value of the CPU Scale-up Step Size parameter 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 is calculated based on the following formula: 4 × Original number of CPU cores. However, the maximum number cannot exceed 32. For example, if the original number of CPU cores of an instance is 4, the CPU cores of the instance can be scaled up to a maximum of 16 cores.

        Scale-down Observation Window

        The time range during which you want to observe the performance of the instance for triggering automatic scale-down. DAS checks the CPU utilization of the instance during the scale-down observation window at specific intervals. If the CPU utilization is less than 30% for 99% of the time, automatic scale-down is triggered.

        The number of CPU cores is decremented by the value of CPU Scale-up Step Size during each scale-down until the instance is scaled back to its original CPU specifications.

      3. Click Next Step. In the Apply Policies dialog box, select the database instances to which you want to apply the policy and click the xy icon.

      4. Click Confirm to apply the policy to the selected database instances.

        Alternatively, you can perform the following steps to apply the policy to a database instance: In the Auto Scaling Policies section, find the policy that 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, click the rightwards arrow, and then click Confirm.

    • Create a prediction-based auto scaling policy on the Autonomous Function Settings tab of the Autonomous Function Management panel.Autonomy Service Settings

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

      2. On the page that appears, find the database instance for which you want to create an automatic scaling policy for local resources and click the instance ID. The instance details page appears.

      3. Click Autonomy Service Settings in the upper-right corner.

      4. On the Autonomous Function Settings tab of the Autonomous Function Management panel, click the Auto Scaling tab. In the Applied Policies section, click Add Policy to create an automatic scaling policy for local resources. For more information, see the Table 1. Parameters section of this topic.

      5. In the Recommended Policies section, find the policy that you created and click Apply in the Actions column.

        Note
        • To modify an existing policy, click Modify in the Actions column of the policy. In the Update Policy panel, update the policy settings.

        • If you no longer want to apply a policy to your instance, click Applied Policies in the Actions column of the policy in the Applied Policies section.

      6. Click OK.

      7. In the Select Alert Template step, configure an alert template for the database instance and subscribe to alert notifications. This helps you understand the status of automatic scaling for local resources at the earliest opportunity.

        The system recommends an alert template and adds alert rules for the required autonomy events in the alert template. You can configure the alert template as prompted.

        Note
        • If you have configured an alert template for your database instance, you must add alert rules for the required autonomy event to the alert template as prompted.

        • If you need to configure an alert template and alert rules for your database instance, follow the instructions described in Configure alert templates and Configure alert rules.

      8. In the Select Alert Contact Group step, select an alert contact group.

        • Click Add Contact to add an alert contact.

        • Click Create Contact Group to create an alert contact group.

        • Find the alert contact that you want to manage and click Edit or Remove in the Actions column to modify or delete information about the alert contact.

        For more information, see Manage alert contacts.

      9. Click Submit Configuration. In the dialog box that appears, confirm the configuration.

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 view the results of automatic scaling for local resources and click its ID. The instance details page appears.

  3. In the left-side pane of the instance details page, click Autonomy Center.

  4. On the Autonomy Center page, select Auto-Scaling Events as Type and select a time range to view the auto scaling events that occurred within the selected time range.

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

    p2022021701