All Products
Search
Document Center

Auto Scaling:Use Auto Scaling to scale application instances in EDAS

Last Updated:Jul 31, 2023

Auto Scaling facilitates the O&M of distributed applications. Auto Scaling can detect the status of instances on which distributed applications run and scales the instances based on the dynamic changes of instance status. This keeps services uninterrupted and improves application availability. This topic describes how to use Auto Scaling to scale application instances in Enterprise Distributed Application Service (EDAS).

Context

  • EDAS is a platform as a service (PaaS) that is used to host applications and manage microservices. EDAS provides full-stack solutions to develop, deploy, monitor, and maintain applications. For more information, see What is EDAS?

  • You can use Auto Scaling to scale applications that are running in Elastic Compute Service (ECS) clusters in EDAS and used for industries such as the Internet, new retail, gaming, and social media. During promotions, these applications experience traffic spikes. As a result, enterprises cannot efficiently balance the fulfillment of service level agreements (SLAs) and the minimization of resource costs. Issues such as high response latency and system breakdown are likely to occur. EDAS uses Auto Scaling to handle traffic spikes within seconds. This ensures that SLAs are fulfilled and resource costs are reduced.

    Note

    An ECS cluster serves as an environment in which you can run applications in EDAS. If you want to use an ECS cluster to host your applications in EDAS, you must create an ECS cluster. For more information, see Create an ECS cluster in the EDAS console or Create an ECS cluster by calling an API operation.

  • In a single-instance environment, Auto Scaling ensures that one instance always runs in the environment. In an environment in which the traffic fluctuates, you can use Auto Scaling to configure the range for the number of instances that your business may require. EDAS adds or deletes application instances based on the configured load balancing rules. Auto Scaling determines whether to enable automatic scaling for application instances based on the instance metrics. The following table describes the metrics.

    Metric

    Description

    CPU

    The CPU utilization. Unit: %.

    RT

    The response time to a request. Unit: milliseconds.

    Load

    The load on the application instance. The value must be a positive integer.

Usage notes

  • If you configure a scale-in rule and a scale-out rule, the metric threshold that you specify in the scale-in rule must be less than or equal to the metric threshold that you specify in the scale-out rule. Otherwise, an error is reported.

  • If you enable the automatic scaling feature for your application in EDAS, the instances that are created by Auto Scaling are preferentially released during scale-ins.

Procedure

You can use Auto Scaling to automatically scale application instances in EDAS. You can configure scaling rules in the EDAS console to enable the automatic scaling feature. The following section describes how to configure a scale-out rule in the EDAS console to enable the automatic scaling feature for application instances.

Note

You can use the same procedure to configure a scale-in rule.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications.

  3. In the top navigation bar, select a region.

  4. In the upper part of the Applications page, select All Microservice Namespaces from the Microservice Namespace drop-down list.

  5. On the Applications page, find the application for which you want to enable the automatic scaling feature and click the name of the application.

  6. In the left-side navigation pane of the application details page, click Auto Scaling.

  7. In the upper-right corner of the Scale-out Rule section, turn on Switch icon.

  8. Configure the parameters that are required for the scale-out rule.

    1. Trigger Metrics: Specify the thresholds for the CPU, RT, and Load metrics. If the thresholds are exceeded, the scale-out rule is automatically triggered.

    2. Trigger Conditions:

      • If you select Any One of the Metrics, the scale-out rule is triggered when one of the configured metrics exceeds the specified threshold. For example, if you specify thresholds for the CPU and RT metrics, the scale-out rule is triggered when one of the metrics exceeds the specified threshold.

      • If you select All Metrics, the scale-out rule is triggered only when all configured metrics exceed the specified thresholds. For example, if you specify thresholds for the CPU and RT metrics, the scale-out rule is triggered only when the two metrics exceed the specified thresholds.

    3. Last for More Than: Configure a period of time during which the metric repeatedly exceeds the threshold. Unit: minutes. Within the configured time period, if the average value of a metric repeatedly exceeds the specified threshold every minute, the scale-out rule is triggered. You can configure this parameter based on the service performance of the ECS cluster.

    4. Application Source:

      • If you select Existing Resources, the system selects a specific number of idle ECS instances that exist in the cluster in which you deploy your application for the scale-out.

        Note

        If the number of idle ECS instances that exist in the cluster cannot meet the scale-out requirement, the scale-out is executed based on the number of existing instances.

      • If you select Elastic Resources, you must set the Creation Method parameter to Purchase Based on Existing Instance Specifications or Purchase Based on Instance Launch Template. This way, the purchased instances are automatically added to the cluster in which you deploy your application for the scale-out. Auto Scaling resources

        The following table describes the parameters.

        Parameter

        Description

        Creation Method

        • Purchase Based on Existing Instance Specifications: Instances are purchased based on the instance type of the instance that is selected from the cluster.

        • Purchase Based on Instance Launch Template: Instances are purchased based on the instance launch template that you created in the ECS console.

        Template Host/Launch Template

        • If you set the Creation Method parameter to Purchase Based on Existing Instance Specifications, you must configure the Template Host parameter and select an existing instance. Then, the system purchases new instances based on the instance type of the selected instance.

        • If you set the Creation Method parameter to Purchase Based on Instance Launch Template, you must configure the Launch Template parameter and select a launch template. Then, the system purchases new instances based on the launch template.

        Password

        If you select Purchase Based on Existing Instance Specifications, you must configure the Password parameter.

        Terms of Service

        You must select <Elastic Compute Service Terms of Service> | <Terms of Service for Images>.

        Advanced Options

        • If you set the Creation Method parameter to Purchase Based on Existing Instance Specifications, the password that you configured is required when you log on to new ECS instances in SSH mode.

        • If you set the Creation Method parameter to Purchase Based on Instance Launch Template, you must set the Network Type parameter to the network in which your application resides. You cannot change the network type after you configure the Network Type parameter. If the network type is virtual private cloud (VPC), you must specify a vSwitch with which you want to associate the new instances. If you specify multiple vSwitches, EDAS allocates instances based on the value that you specified for the Multi-zone Scaling Policy parameter. Valid values of the Multi-zone Scaling Policy parameter are Priority Policy and Balanced Distribution Policy.

      • If you select Existing Resources First, EDAS preferentially uses idle instances in the cluster. If the number of idle instances cannot meet the scale-out requirement, Auto Scaling purchases the required number of instances for EDAS.

    5. Number of Instances to Add for Each Scale-Out: Enter the number of instances that you want to scale out each time.

    6. Maximum Number of Instances in Group: Enter the maximum number of instances that are allowed in the cluster. If the maximum number of allowed instances is reached, the system no longer scales out instances. Configure this parameter based on your resource quota.

  9. In the lower part of the Auto Scaling page, click Save.

Verify whether scaling rules take effect

After a scale-out or scale-in rule is triggered, you can use one of the following methods to verify whether the rule takes effect:

  • On the Basic Information page of your application, check whether the number of instances increases or decreases.

    If the number of instances increases or decreases, the scale-out or scale-in rule is in effect.

  • In the left-side navigation pane of the application details page, click Change Records to view all change records of the application.

    Find the change record whose Change Type is set to Scale out Application or Scale in Application and whose Source is set to auto_scale. Then, click View in the Actions column. On the page that appears, view the change details.