This topic describes how to configure different advanced parameters in an auto scaling policy and verify the impacts of these parameters on the system behavior.
Prerequisites
Stress testing is executed for an application in Performance Testing Service (PTS) to verify the impacts of advanced parameters in an auto scaling policy on application instance scaling. You must complete the following steps before the stress testing.
Create an Serverless App Engine (SAE) application.
NoteTo simplify the stress testing, set the number of application instances to 1.
Bind a Classic Load Balancer (CLB) instance deployed on the Internet to the application and enable the access log feature of CLB.
NoteAfter you enable the access log feature of CLB, you are charged additional fees.
Advanced parameters
When you configure a metric-based auto scaling policy or a hybrid auto scaling policy for an application, Serverless App Engine provides five advanced parameters. The following list describes them.
Scale-out Step Size: the maximum number of instances that can be scaled out per unit time.
Scale-in Step Size: the maximum number of instances that can be scaled in per unit time.
Scale-out Stabilization Window: the period of time during which the scale-out is stable. The auto scaling algorithm is used to ensure that the minimum number of expected instances calculated within the specified interval is used when a scale-out operation is performed.
Scale-in Stabilization Window: the period of time during which the scale-in is stable. The auto scaling algorithm is used to ensure that the maximum number of expected instances calculated within the specified interval is used when a scale-in operation is performed.
Disable Scale-in: specifies that application instances cannot be scaled in.
Configure an auto scaling policy for an application
When you configure a metric-based auto scaling policy or a hybrid auto scaling policy, you can configure advanced parameters for the auto scaling policy. This section describes only the key steps.
The metric-based auto scaling policy configured in this section is available only to the stress testing. In the production environment, adjust the settings based on your business requirements.
-
On the Basic Information page of the target application, click the Auto Scaling tab, and then click Create Auto Scaling Policy.
-
On the panel that appears, configure an auto scaling policy based on the public CLB QPS metric and set the target value to 10.
NoteNo advanced parameters are specified.
For Policy Type, select metric-based auto scaling policy, set Policy Name to demo, Minimum Number of Instances to 1, and Maximum Number of Instances to 5. For Minimum Number of Ready Instances, select By Ratio and set the value to 50%.
-
After you add the metric-based auto scaling policy, enable the policy.
Verify the impacts of advanced parameters
Before you verify each advanced parameter, make sure that no advanced parameters are specified in a metric-based auto scaling policy.
Verify the Scale-out Step Size parameter
Because the logic for scale-out step size is similar to that for scale-in step size, this section only verifies the scale-out step size parameter.
Verify scale-out effect without the Scale-out Step Size parameter specified
Log on to the PTS console and perform stress testing on the SAE application.
NoteThe URL used in the stress testing is the IP address of the CLB instance that is bound to the SAE application and deployed on the Internet. The URL is in the format of
http://Public IP address port number.-
After the stress testing starts, you can view the auto scaling events of the SAE application.
Filter by Source Type and select auto scaling (HorizontalPodAutoscaler). You can view records with the reason SuccessfulRescale. Expand the details to see that the scale-out was triggered because the external metric
slb_incall_qpsexceeded the target value.The auto scaling events show that the HPA controller has expanded the SAE application to 5 instances.
Verify scale-out effect with the Scale-out Step Size parameter specified
-
Configure the scale-out step size parameter in the metric-based auto scaling policy.
-
On the Basic Information page of the target application, click the Auto Scaling tab, and then click Edit in the Actions column for the added auto scaling policy.
-
In the Edit Auto Scaling Policy panel, click Advanced Settings to expand the advanced parameter configuration area.
-
In the Advanced Settings area, set scale-out step size to
1, leave the other advanced parameters unconfigured, and then click OK.
-
Use PTS to perform stress testing on the SAE application.
-
After the stress test starts, go to the Application Events page to view the auto scaling events for the target SAE application.
Auto scaling events show that instances in the SAE application are scaled out one by one, instead of scaling out to five instances at a time. This indicates that the Scale-out Step Size parameter is taking effect and limits the number of instances that are scaled out each time, thus achieving a balance between system stability and response speed by controlling the scale-out rhythm.
Verify the Scale-out Stabilization Window parameter
Given that the logic for the scale-out stabilization window parameter is similar to that for the scale-in stabilization window parameter, this section only verifies the scale-out stabilization window parameter.
Verify scale-out effect without the Scale-out Stabilization Window specified
-
Log on to the Performance Testing Service (PTS) console and run a quick stress test on the target SAE application.
NoteThe URL used for the stress test is the access address of the public CLB instance bound to the SAE application. The URL format is
http://<Public IP address>:<Port>. -
After the stress testing starts, you can compare the start time of the stress test and the scale-out time of the SAE application.
Start time of stress testing
Start time of scaling out the SAE application
View the time on the Report List page.
You can view information such as Test Time, Report Name, Report ID, Duration, Peak Concurrency, and VUMs Consumed for each stress test record. Find the record with the test time 2025-03-07 17:36:55 and click the corresponding View Report link to view the test results.
2025-03-07 17:36:55
View the time on the Application Events page.
2025-03-07 17:37:21
The test shows that without the scale-out stabilization window parameter configured, instances scaled out rapidly, about 20 seconds after the SAE application began handling traffic.
Verify scale-out effect with the Scale-out Stabilization Window specified
-
Configure the scale-out stabilization window parameter in the metric-based auto scaling policy.
-
On the Basic Information page of the target application, click the Auto Scaling tab, and then click Edit in the Actions column for the added auto scaling policy.
-
In the Edit Auto Scaling Policy panel, click Advanced Settings to expand the advanced parameter configuration area.
-
In the Advanced Settings area, set the scale-out stabilization window to
300seconds, leave the other advanced parameters unconfigured, and then click OK.
-
-
Use the PTS tool to run a quick stress test on the target SAE application.
-
After the stress testing starts, you can compare the start time of the stress test and the scale-out time of the SAE application.
Start time of stress testing
Start time of scaling out the SAE application
View the time on the Report List page.
Find the target stress test report record, confirm the Test Time, and click View Report in the Actions column to view the test results.
2025-03-10 09:50:35
View the time on the Application Events page.
The event list shows a record with an event level of Normal, a reason of SuccessfulRescale, and a source type of HorizontalPodAutoscaler. This indicates that the number of Pods was successfully adjusted to 5 based on the external metric
slb_incall_qps.The test result shows that when the Scale-out Stabilization Window parameter is set to 300, an instance scale-out operation is not immediately triggered after the SAE application receives traffic. Instead, an instance scale-out operation starts after the specified stabilization window ends. This indicates that the Scale-out Stabilization Window parameter can effectively delay scale-out operations and avoid resource waste caused by short-term traffic fluctuations.
Verify the Disable Scale-in parameter
Verify scaling effect without Disable Scale-in enable
-
Log on to the Performance Testing Service (PTS) console and run a quick stress test on the target SAE application.
NoteThe URL used for the stress test is the access address of the public CLB instance bound to the SAE application. The URL format is
http://<Public IP address>:<Port>. -
After the stress test is complete, go to the Application Events page to view the application's scaling events.
After filtering by Source Type for auto scaling (HorizontalPodAutoscaler), the event list shows two SuccessfulRescale events. The first was a scale-out to 5 instances during the test, triggered when the external metric
slb_incall_qpsexceeded its target. The second was a scale-in to 1 instance after the test, triggered when all metrics fell below their targets.The test shows that if the disable scale-in parameter is not enabled, the application scales in to a single instance after the stress test completes.
Verify scaling effect with Disable Scale-in enabled
-
In the metric-based auto scaling policy, enable disable scale-in.
-
On the Basic Information page of the target application, click the Auto Scaling tab, and then click Edit in the Actions column for the added auto scaling policy.
-
In the Advanced Settings area, enable disable scale-in.
-
-
Use the PTS tool to run a quick stress test on the target SAE application.
NoteThe specified stress testing duration is 10 minutes.
-
After the stress testing is complete (the traffic is 0), check whether application instances have been scaled in.
The instance list shows that all five instances are in the Running state. Four instances have been running for about 15 minutes (created during the scale-out), and one instance has been running for about 5 hours (the original instance). None of the instances were scaled in.
The test result shows that the number of application instances remains at 5 within about 5 minutes after the stress testing is complete, and no scale-in operation occurs. This indicates that the Disable Scale-in parameter has taken effect. This can effectively avoid excessive resource release caused by traffic fluctuations or misjudgments, thus ensuring service stability.