Configure gateway auto scaling

Updated at:

The auto scaling feature automatically adjusts instance resources based on traffic fluctuations. This feature ensures service performance during traffic peaks and reduces resource costs during traffic lulls.

Scaling policies

  • Use cases for scheduled scaling

    Use scheduled scaling for business scenarios with periodic and predictable traffic peaks, such as major promotions, special events, or online games.

  • Use cases for metric-based scaling

    Metric-based scaling is suitable for scenarios with unpredictable traffic. It dynamically adjusts resources based on monitoring metrics such as CPU and memory usage. For details about capacity, see Capacity.

Usage notes

  • Do not change the scaling policy during an active scaling event.

  • When auto scaling is active, newly added nodes are billed on a pay-as-you-go basis.

Auto scaling configuration

  1. Log on to the API Gateway console.

  2. In the left-side navigation pane, click Cloud-native API Gateway > Instance. In the top navigation bar, select a region.

  3. Use one of the following methods to open the auto scaling panel:

    • Method 1:

      On the Instance page, find the target gateway instance. In the Actions column, click the image icon and select Auto Scaling.

    • On the Instance page, click the name of the target gateway instance to open its overview page, and then enable Auto Scaling.

  4. In the Auto Scaling panel, on the Scaling Configurations tab, turn on the Auto scaling is effective. switch and configure the parameters.

    The panel displays information such as Current Instance Type, Scaling Step Size, and Auto Scaling Range. A notification at the top reminds you that new nodes are billed on a pay-as-you-go basis.

    Note

    When you update a scaling policy, a new time period will take effect in the next 24-hour cycle if its start time has not yet passed.

    The following table describes the parameters.

    Parameter

    Description

    Auto scaling is effective.

    Enables or disables the scaling policy.

    Note

    When enabled, you cannot manually scale the instance in or out, or change its specifications.

    Scaling Method

    Supported methods are Scaling by Time and Expansion and contraction by water level.

    • Scaling by Time: Recommended for scenarios with predictable high-traffic events. For best results, use this method in conjunction with rate limiting.

    • Expansion and contraction by water level: Scales resources based on performance metrics. Note that scaling activities are not instantaneous and can take several minutes to complete.

    Time period configuration

    Configure the time periods and the target total number of nodes. You can update the policy by modifying the Time period configuration on the Scaling Configurations tab.

    Note

    At the beginning of each time period, the gateway scales out to the target number of nodes. At the end of the period, it scales back to the original number of nodes.

    • Time Period (UTC+8): You can define one to three non-overlapping time periods within a 24-hour cycle. A time period can span across midnight.

    • Target Total Nodes: The total number of nodes after the gateway scales out.

    Expansion and contraction by water level

    Maximum nodes

    The maximum number of nodes the gateway can scale out to.

    Safe Threshold

    A threshold designed to maintain performance by reserving capacity to handle a sudden doubling of traffic.

    Warning Threshold

    When the warning threshold is reached, the gateway's latency may increase. For more information about capacity thresholds and queries per second (QPS) for different instance specifications, see Capacity.

Scaling events

Click the Scaling Events tab in the Auto Scaling panel to open the event page, where you can manage and analyze all gateway scaling events. For more information, see Event Management.

The Event page displays records of scaling events. The event names include APIG:ElasticScaleOut:Executing (scaling out), APIG:ElasticScaleOut:Executed (scale-out successful), APIG:ElasticScaleIn:Executing (scaling in), and APIG:ElasticScaleIn:Executed (scale-in successful). All these events have a severity level of Info. You can filter events by level, event name, keyword, and time range. Click Details to view an event's details.