Scenarios
Cloud-native gateways can automatically increase or decrease the number of nodes, that is, scale out or in, based on pre-configured AS rules, thereby improving resource utilization and reducing resource costs. AS supports two types of scaling policies: metric-based and scheduled. (Supported only in the Professional Edition)
Metric scaling: applies to scenarios with sudden traffic spikes and typical periodic traffic. The elastic scaling trigger condition and node quantity change are described using the metric name and threshold.
Scheduled rules: These rules are suitable for application scenarios where resource utilization follows a periodic pattern. After the configured periodic time point is reached, the TSF cloud-native gateway automatically adjusts the number of instance nodes according to the configured policy.
Prerequisites
Operation Steps
Step 1: Creating an Elastic Scaling Policy
2. After you go to the instance details page, select the AS tab on the Basic Information page, and then click Create Policy.
3. In the displayed Create Elastic Scaling Policy dialog box, specify the policy information:
Metric and Scheduled Scaling
Node Quantity Range: number of nodes for AS. The minimum value is the number of nodes in the group, and the maximum value is 100.
Metric Scaling: Elastic scaling is triggered when one condition is met.
Metric Name: elastic scaling trigger condition. You can configure thresholds for monitoring metrics (CPU utilization, memory utilization, and QPS).
Threshold: threshold of the metric for triggering elastic scaling.
Policy Name: Enter the name of the elastic scaling policy.
Description: Enter the description of the elastic scaling policy.
Node Quantity Range: number of nodes for elastic scaling. The minimum value is the number of nodes in the group, and the maximum value is 20.
Scheduled Scaling: If multiple rules are triggered at the same time, they are executed in sequence. You can drag the rules to adjust the order. If the trigger time of a rule is earlier than the current time, the rule takes effect from the next period.
Period: period for executing the scheduled elastic scaling policy.
Node Quantity: number of nodes after elastic scaling takes effect.
Trigger Time: specific time point when AS is triggered.
Policy Name: Enter the name of the elastic scaling policy.
Description: Enter the description of the elastic scaling policy.
Node Quantity Range: number of nodes for elastic scaling. The minimum value is the number of nodes in the group, and the maximum value is 20.
Scheduled Scaling: If multiple rules are triggered at the same time, they are executed in sequence. You can drag the rules to adjust the order. If the trigger time of a rule is earlier than the current time, the rule takes effect from the next period.
Period: period for executing the scheduled elastic scaling policy.
Node Quantity: number of nodes after elastic scaling takes effect.
Trigger Time: specific time point when AS is triggered.
Metric Scaling: Elastic scaling is triggered when one condition is met.
Metric Name: elastic scaling trigger condition. You can configure thresholds for monitoring metrics (CPU utilization and memory utilization).
Threshold: threshold of the metric for triggering elastic scaling.
Policy Name: Enter the name of the elastic scaling policy.
Description: Enter the description of the elastic scaling policy.
4. Click Confirm. A dialog box is displayed, indicating that the elastic scaling policy takes effect only after it is bound to a cluster group. You can bind a group directly or later.
Step 2: Binding a Cluster Group for an Elastic Scaling Policy to Take Effect
An elastic scaling policy takes effect only after it is bound to a cluster group. You can bind one or more cluster groups at a time.
1. On the Elastic Scaling tab page, click Bind Group on the right of the target policy in the policy list.
2. In the displayed Bind Cluster Group dialog box, select one or more cluster groups and click Confirm. The policy takes effect immediately after it is bound to a group.
Step 3: Viewing Cluster Groups Bound to a Policy
1. On the Elastic Scaling tab page, click the target policy in the policy list to go to the policy details page.
2. Click the Bound Group tab page to view the cluster groups bound to the policy. You can bind new groups or unbind existing groups.
Step 4: Editing an Elastic Scaling Policy
1. On the Elastic Scaling tab page, click Edit on the right of the target policy in the policy list.
2. On the Edit Elastic Scaling Policy page, modify the trigger condition, elastic scaling range, name, or description of the policy.
3. Click OK to complete the editing.
Step 5: Deleting an Elastic Scaling Policy
1. On the Elastic Scaling tab page, click Delete on the right of the target policy in the policy list.
2. In the displayed Delete Policy dialog box, confirm whether to delete the policy again.
3. Click OK. The policy is deleted.
Attention:
After deletion, the policy becomes invalid immediately, is automatically unbound from the previously bound groups, and stops automatic scaling. Proceed with caution.
Configuring Metric Scaling and Scheduled Scaling Simultaneously
Scheduled scaling triggers AS of gateway nodes by setting schedules. It is commonly used for periodic tasks. Metric scaling performs AS of nodes by configuring thresholds for key metrics. It is typically used to prevent situations such as sudden traffic surges. In practice, you can configure both methods. When the cloud-native gateway detects that both policies are configured, it adjusts the number of nodes by combining the content of both policies.
When both policies take effect, scheduled scaling does not adjust the number of nodes directly. Instead, it adjusts the node quantity range of metric scaling for scaling judgment and adjustment. The adjustment rules are as follows:
When the current number of nodes is equal to the number of target nodes of scheduled scaling, adjustment is not performed.
When the current number of nodes is less than the number of target nodes of scheduled scaling:
If the number of target nodes of scheduled scaling is greater than the minimum number of nodes of metric scaling, adjust the minimum number of nodes of metric scaling to the target number of nodes of scheduled scaling.
If the number of target nodes of scheduled scaling is less than the maximum number of nodes of metric scaling, the maximum number of nodes of metric scaling is not adjusted.
When the current number of nodes is greater than the number of target nodes of scheduled scaling:
If the number of target nodes of scheduled scaling is greater than the minimum number of nodes of metric scaling, the minimum number of nodes of metric scaling is not adjusted.
If the number of target nodes of scheduled scaling is less than the maximum number of nodes of metric scaling, the maximum number of nodes of metric scaling is not adjusted.
The number of nodes is adjusted accordingly based on the node quantity range of metric scaling to achieve elastic scaling of nodes.
The following table describes the node scaling results in different scenarios when the two policies take effect simultaneously.
|
Minimum value: 1; Maximum value: 10 | 5 | 5 | Minimum value: 1; Maximum value: 10 | 5 |
Minimum value: 1; Maximum value: 10 | 7 | 5 | Minimum value: 7; Maximum value: 10 | 7 |
Minimum value: 1; Maximum value: 10 | 3 | 5 | Minimum value: 1; Maximum value: 10 | 5 |