Updated on 2024-10-29 GMT+08:00

Scaling a Workload

This section describes two workload scaling methods: auto scaling and manual scaling.

  • Auto scaling: Supports metric-based, scheduled, and periodic policies. When the configuration is complete, pods can be automatically added or deleted based on resource changes or a specified schedule.
  • Manual scaling: Increases or decreases the number of pods immediately after the configuration is complete.

If a pod mounted with an EVS volume is deleted, the EVS disk will not be deleted. If a new pod with the same name is created, the new pod cannot be mounted to any EVS volume.

Auto Scaling

Currently, auto scaling is supported only for Deployments.

An appropriate auto scaling policy eliminates the need to manually adjust resources in response to service changes and traffic peaks, thus helping you reduce the workforce and resources required. CCI supports the following types of auto scaling policies:

Metric-based: Scales the workload based on vCPU/memory usage. You can specify a CPU/memory usage threshold. If the usage is higher or lower than the threshold, instances can be automatically added or deleted.

Scheduled: Scales the workload at a specified time. A scheduled scaling policy is ideal for scenarios such as flash sales and anniversary promotions.

Periodic: Scales the workload on a daily, weekly, or monthly basis. A periodic scaling policy is ideal for applications that have periodic traffic changes.

  • Configure a metric-based auto scaling policy.
    1. Log in to the CCI console. In the navigation pane on the left, choose Workloads > Deployments. On the page displayed, locate the Deployment and click its name.
    2. In the Scaling area of the Deployment details page, click Auto Scaling and then click Add Scaling Policy.
      Figure 1 Adding a metric-based auto scaling policy
      Table 1 Parameters of a metric-based auto scaling policy

      Parameter

      Description

      Policy Name

      Enter a name for the policy.

      Policy Type

      Select Metric-based policy.

      Trigger Condition

      Select CPU usage or Memory usage.

      If you set the trigger condition to average memory usage > 70%, the scaling policy will be triggered when the average memory usage exceeds 70%.

      Duration

      Statistical period. Select a value from the drop-down list.

      If you set this parameter to 60, metric statistics will be collected every 60 seconds.

      Consecutive Times

      If you set this parameter to 3, the configured action will be triggered when the threshold is reached for 3 consecutive statistical periods.

      Policy Action

      Specify the action to be executed when the policy is triggered. You can specify an action to add or reduce the number of instances.

    3. Click OK.
      The policy is added to the policy list, and its status is Enabled.
      Figure 2 Policy enabled

      When the trigger condition is met, the auto scaling policy will be executed.

  • Configure a scheduled auto scaling policy.
    1. In the Scaling area, click Auto Scaling and then click Add Scaling Policy.
      Figure 3 Adding a scheduled auto scaling policy
      Table 2 Parameters of a scheduled auto scaling policy

      Parameter

      Description

      Policy Name

      Enter a name for the policy.

      Policy Type

      Select Scheduled Policy.

      Triggered

      Specify the time when you want the policy to be triggered.

      Policy Action

      Specify the action to be executed when the policy is triggered. You can specify an action to add or reduce the number of instances.

    2. Click OK.

      The policy is added to the policy list, and its status is Enabled.

  • Configure a periodic auto scaling policy.
    1. In the Scaling area, click Auto Scaling and then click Add Scaling Policy.
      Figure 4 Adding a periodic auto scaling policy
      Table 3 Parameters of a periodic auto scaling policy

      Parameter

      Description

      Policy Name

      Enter a name for the policy.

      Policy Type

      Select Periodic Policy.

      Select Time

      Select the time range, frequency, and time when you want the policy to be triggered.

      Policy Action

      Specify the action to be executed when the policy is triggered.

    2. Click OK.

      The policy is added to the policy list, and its status is Enabled.

Manual Scaling

  1. Log in to the CCI console. In the navigation pane on the left, choose Workloads > Deployments. On the page displayed, locate the Deployment and click its name.
  2. Under Manual Scaling in the Scaling area, click and modify the number of instances (for example, change the value to 3), and then click Save. The scaling takes effect immediately.

    CCI provides a time window for running pre-stop processing commands before an application is deleted. If a command process is still running when the time window expires, the application will be forcibly deleted.

    Figure 5 Changing the number of instances

  3. In the pod list, you can see the new pods being created. When the status of all added pods changes to Running, the scaling is completed successfully.

    Figure 6 Pod list after a manual scaling