Updated on 2024-05-25 GMT+08:00

Configuring a Hybrid AS Policy

This section describes how to configure a hybrid AS policy. You can configure metrics and time segments at the same time to control instance scaling.

CAE instance scaling is calculated by current and expected metrics.

Expected instances = ceil [Current instances * (Current metrics/Expected metrics)] (ceil is rounded up.)

There is an error tolerance of 10% to prevent frequent fluctuation of instance quantity, so there is no scaling when Current metrics/Expected metric ranges from 0.9 to 1.1.

Application Scenario

This policy is useful for periodic resource usage, burst traffic, and typical periodic traffic, mainly used in industries such as the Internet, education, and catering.

Procedure

  1. Log in to CAE.
  2. Choose Component Configurations.
  3. Select the target component from the drop-down list in the upper part of the page.

    Figure 1 Selecting a component

  4. Click Edit in the AS Policies module.
  5. Select Hybrid and configure the policy by referring to Table 1.

    Table 1 Configuring a hybrid policy

    Parameter

    Description

    Max. Instances

    Max. number of instances that can be reached during scale-out.

    Value range: 1 to 99.

    NOTE:

    Max. Instances must be greater than Min Instances.

    Min Instances

    Min number of instances that can be reached during scale-in.

    Value range: 1 to 99.

    Metric

    • CPU usage, a preset metric in the system
    • Memory usage, a preset metric in the system
    • Custom metrics. Click Add Expected Value and select a custom metric from the drop-down list to add a custom metric. For details about how to create a custom metric, see Configuring Custom Metrics.

      You can add multiple custom metrics.

      NOTE:
      • You must enter a PromQL statement. PromQL is a built-in data query language from Prometheus, and is used to select, aggregate, and perform logical calculation on time series data. For details, see Prometheus.
      • The query result of the PromQL statement must be a single value of the vector or scalar type.
      • Upgrade the component created/upgraded before November 3, 2023 for the custom scaling policy to take effect.

    Trigger Cycle

    The policy is expected to be executed at a specified interval. Value: Every day, Every day, or Monthly.

    Trigger Time in a Day

    This parameter is mandatory when Trigger Cycle is set to Every day.

    Configure the policy triggered every day.

    For example, the number of instances remains 3 after 18:00 every day.

    Click Add Trigger Time to add more time policies.

    Trigger Time in a Week

    This parameter is mandatory when Trigger Cycle is set to Every week.

    Configure the policy triggered every week.

    For example, the number of instances remains 4 after 08:00 on every Monday.

    Click Add Trigger Time to add more time policies.

    Trigger Time in a Month

    This parameter is mandatory when Trigger Cycle is set to Monthly.

    Configure the policy triggered every month.

    For example, the number of instances remains 4 after 06:00 on the fifth day of each month.

    Click Add Trigger Time to add more time policies.

    The rules of a hybrid policy are OR related. When either the time or metric policy meets the condition, scaling is triggered.

    For example, set the maximum expected CPU usage to 80 and memory usage to 70, set Trigger Cycle to Every day, and set From 18:00 and Instances 3, and From 00:00 and Instances 1. The system keeps 1 instance from 00:00 to 18:00. However, if the CPU usage of a component is greater than 80% or the memory usage is greater than 70% during this period, the system automatically increases the number of component instances.

    Figure 2 Configuring a hybrid policy

  6. (Optional) Expand Advanced Settings and configure advanced settings by referring to Table 2.

    Table 2 Configuring advanced settings

    Parameter

    Description

    Scale-out Step

    Number of pods to be added per minute.

    Value range: 1 to 99. Default value: 4.

    Stable Scale-out Window (s)

    Value range: 1 to 3600, in seconds. Default value: 0.

    Scale-in Step

    Number of pods to be reduced per minute.

    Value range: 1 to 99. Default value: 99.

    Stable Scale-in Window (s)

    Value range: 1 to 3600, in seconds. Default value: 300.

    Disable Scale-in

    Click to disable scale-in.

    Figure 3 Advanced settings

  7. Click OK.
  8. Click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.