SAE auto scaling automatically scales out application instances when traffic peaks arrive within seconds and scales them in after the peaks end to ensure that your applications run smoothly. This feature is highly reliable, O&M-free, and cost-effective. For example, to handle e-commerce promotions, you can deploy applications, configure auto scaling rules, monitor and adjust policies in real time, and perform subsequent O&M optimizations. This entire process ensures that your platform responds to user needs efficiently and stably.
Auto scaling workflow
The end-to-end workflow for an SAE auto scaling scenario is shown in the following figure.

Prepare your application
Configure a health check: To ensure overall application availability during auto scaling. A health check routes traffic to an instance only after it has started and is ready to serve requests. For more information, see Set a health check.
Configure application lifecycle management: Ensure a graceful shutdown during scale-in events by configuring PreStop Settings. For more information, see Set up application lifecycle management.
Implement an exponential backoff mechanism for service calls in your Java application to prevent failures caused by scaling delays, slow startups, or a lack of graceful shutdown.
Optimize your application's startup speed.
Package optimization: Optimize application startup time by minimizing external factors like class loading and caching.
Image optimization: Reduce the image size to shorten pull times when creating new instances. You can use open-source tools to analyze and streamline image layers.
Java application startup optimization: Enable application acceleration when creating an application in SAE by selecting the Dragonwell 11 environment.
Configure an auto scaling policy
Choose scaling metrics
SAE supports multiple metrics from Basic Monitoring and Application Monitoring. You can flexibly configure these metrics based on whether your application is CPU-intensive, memory-intensive, or I/O-intensive.
You can review historical data for relevant metrics from Basic Monitoring and Application Monitoring (such as peak values, P95, or P99 over the last 6 hours, 12 hours, 1 day, or 7 days) to estimate a target value. Use a load testing tool like Performance Testing Service (PTS) to evaluate your application's peak capacity by determining its concurrent request limit, resource requirements (CPU and memory), and high-load response behavior.
When you configure an auto scaling policy, consider the following factors:
Balance availability and cost when setting metric target values. For example:
Availability-optimized strategy: Set the metric value to 40%.
Balanced strategy: Set the metric value to 50%.
Cost-optimized strategy: Set the metric value to 70%.
Review dependencies such as upstream and downstream services, middleware, and databases. Configure corresponding auto scaling policies or throttling and degradation mechanisms to ensure end-to-end availability during scale-out events.
After you configure the auto scaling policy, you can monitor and adjust it to align your capacity more closely with the actual application load. For more information about monitoring, see View Basic Monitoring data.
Configure memory metrics
For Java applications, runtime optimization improves the correlation between memory metrics and business load by releasing physical memory. By using the Dragonwell runtime and adding a JVM parameter to enable the ElasticHeap feature, you can support dynamic scaling of the Java heap memory. This reduces your application's physical memory consumption at runtime. For more information about ElasticHeap, see G1ElasticHeap.
We recommend the Dragonwell+ElasticHeap Periodic uncommit (automatic) mode. For detailed steps, see Deploy a Java application and Set a startup command.
Java Environment: In the Configure JAR Package section, select a Dragonwell configuration from the Java Environment drop-down list.

JVM parameter: In the Startup Command Settings section, enter -XX:+ElasticHeapPeriodicUncommit.

Memory-based scaling is not suitable for some applications that use dynamic memory management, such as those relying on Java JVM memory management or Glibc Malloc and Free operations. If these applications do not promptly release idle memory to the operating system, instance memory consumption does not decrease in real time. This delay can also prevent scale-in events from triggering, as the average memory consumption across instances remains high.
Configure instance count
Minimum instances
Set minimum instances to 2 or more, and configure vSwitches across multiple zones. This setup prevents application downtime if an instance is evicted due to an underlying node failure or if no instances are available in a zone.
Maximum instances
Ensure that the maximum instances is less than or equal to the number of available IP addresses in the vSwitch. This prevents scale-out failures caused by a shortage of IP addresses.
Check the number of available IP addresses for the current application in the Application Information section on the Basic Information page. If the number of available IP addresses is low, replace or add a vSwitch.

Observe the auto scaling process
Maximum instance limit
On the application's Overview page, you can see its auto scaling status. Monitor any applications that reach their maximum instance limit and re-evaluate their auto scaling configuration.

If a single application needs to scale out to more than 50 instances, join the DingTalk group (group ID: 32874633) to apply for the allowlist.
Zone rebalancing
After a scale-in event, instances may become unevenly distributed across zones. You can view the zone of each instance in the instance list on the application's Basic Information page. If the distribution is imbalanced, you can trigger zone rebalancing by performing a Restart on an instance.

Automatic resumption
When you perform a change order, such as deploying an application, SAE temporarily stops the auto scaling policy for that application to prevent conflicts. If you want the policy to be restored after the change order is complete, select Automatic on the Deploy Application page.

Auto scaling maintenance
Application events
On the Application Events page for the target application, you can observe the behavior of SAE auto scaling, including the time and type of scaling actions. Use this information to evaluate the effectiveness of your auto scaling policy and make adjustments as needed. For more information, see View application events.

Application instance trend chart
On the application's Basic Information page, the Basic Information tab contains the Application Instance Trend Chart. This chart displays monitoring metrics for the last 7 days, including CPU utilization, memory usage, active TCP connections, service requests, and average response time.
