Auto scaling is an important O&M capability for distributed application management. Auto scaling perceives the status of each instance in an application and implements dynamic scaling accordingly. This topic describes how to increase and reduce application instances by using manual scaling and auto scaling so that you can efficiently use application resources and reduce the cost of application resources while ensuring the quality of service.

Why is scaling required?

Applications such as the Internet and games are prone to sudden traffic flooding during promotional activities. The imbalance between service level agreement (SLA) and resource costs easily leads to delayed system response and system breakdown. Enterprise Distributed Application Service (EDAS) inherits the traffic flood management technology used by Alibaba to cope with Double 11, and provides second-level auto scaling to reduce instance retention costs while ensuring SLA. Auto scaling is applicable to industries such as the Internet, games, and social networking platforms.

Manual scaling

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Resources > Clusters. On the Cluster Details page, click the application name in Applications.
    You can also choose Application Management > Applications from the left-side navigation pane, and then click the name of the Container Service Kubernetes application on the Applications page.
  3. In the upper-right corner of Application Overview, click Manual Scaling.
  4. In the Application Scaling dialog box, set Total Pods, and then click OK.
    If the number of pods is 0, the system physically deletes all pods under the application and only retains the basic creation information of the application.

After the configuration, the Container Service Kubernetes cluster automatically completes the scale-out or scale-in of the application.

Auto scaling

EDAS monitors the CPU utilization and memory usage of your applications and automatically scales your application instances out or in based on auto scaling policies.

Notice
  • You can configure only one metric-based scaling policy in a single application.
  • When a scaling policy is enabled, do not manage the lifecycle of an EDAS application. Disable the policy and then perform the management.
  • You cannot add an auto scaling policy when you perform application changes, such as application deployment, application scaling, and specification changes.
  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Resources > Clusters. On the Cluster Details page, click the application name in Applications.
    You can also choose Application Management > Applications from the left-side navigation pane, and then click the name of the Container Service Kubernetes application on the Applications page.
  3. On the Application Overview page, click the Application Settings tab and click the Auto Scaling collapse panel. After the collapse panel is expanded, click Add Flexible Strategy.
    You can also click Auto Scaling in the upper-right corner of the Application Overview page.
  4. On the Add Flexible Strategy panel that appears on the right side, configure auto scaling rules, and then click Confirm.
    • Strategy Name: indicates the name of the auto scaling policy, which must start with a letter and can contain letters, digits, underscores (_), and hyphens (-). The value must be 1 to 64 characters in length.
    • Strategy Type: only supports metric-based scaling policies and will support scheduled scaling policies soon.
    • Triggering Conditions: supports CPU Usage and Mem Usage.
    • Maximum Number of Application Instances: indicates the target number of instances that can be scaled out when the auto scaling conditions are triggered.
    • Minimum Number of Application Instances: indicates the target number of instances that can be scaled in when the auto scaling conditions are triggered.
    Note
    • When either CPU Usage or Mem Usage is selected, if the CPU utilization or memory usage of the current application is not lower than the preset target value, the application is scaled out and the target number of the application instances cannot exceed the value of Maximum Number of Application Instances. Conversely, the application is scaled in and the target number of the application instances cannot be smaller than the value of Minimum Number of Application Instances.
    • When both CPU Usage and Mem Usage are selected, if both values are not lower than the preset values, the application is scaled out and the target number of the application instances cannot exceed the value of Maximum Number of Application Instances. Conversely, the application is scaled in and the target number of the application instances cannot be lower than the value of Minimum Number of Application Instances.

    The formula of calculating the values of Maximum Number of Application Instances and Minimum Number of Application Instances is as follows: Target number of instances = Current number of instances × (Current metric value/Expected metric)

  5. In Monitoring Indicator Strategy List, click Enable in the Operating column.

Verify the result (auto scaling)

The following figure shows the number of application instances before auto scaling.

The following figure shows the auto scaling policy.

After this auto scaling policy is enabled, EDAS automatically monitors the CPU utilization. When the trigger conditions are met, EDAS scales the application instances out or in based on this policy.

Compared with that before the auto scaling, one pod is increased, which indicates that one application instance is successfully added through auto scaling.

References

After enabling an auto scaling strategy, you can delete, stop, enable, and edit the auto scaling strategy.