All Products
Search
Document Center

Platform For AI:Scheduled auto scaling

Last Updated:Mar 11, 2026

Automatically adjust replica count based on predefined schedules. Scale out before traffic peaks and scale in during off-peak hours to optimize costs.

Configure in console

Enable scheduled auto scaling

  1. Log on to the PAI console. Select a region on the top of the page. Then, select the desired workspace and click Elastic Algorithm Service (EAS).

  2. In the service list, click the target service to open its Overview page.

  3. On the Auto Scaling tab, in the Scheduled Scaling section, click Enable Scheduled Scaling.

  4. In the CronHPA Settings dialog box, configure the following parameters. Click Add to configure multiple tasks. Click OK when finished.

    Parameter

    Description

    Task Name

    Name of the scheduled scaling task.

    Target Replicas

    Expected number of replicas.

    Scaling Schedule

    Time to execute the task. Set the time in one of the following ways:

    • Week: A recurring weekly schedule.

    • Day: A recurring daily schedule.

    • Cron Expression: Set the schedule using a cron expression.

Update configuration

  1. On the Auto Scaling tab, in the CronHPA section, click Manage CronHPA.

  2. In the CronHPA Settings dialog box, modify the configurations for Task Name, Target Replicas, or Scaling Schedule.

  3. Click Update.

Disable scheduled auto scaling

  1. On the Auto Scaling tab, in the CronHPA section, click Disable Scheduled Scaling.

  2. In the Confirm Disable dialog box, click Confirm.

Configure using local client

Enable or update scheduled auto scaling

After creating a service, Scheduled Scaling is disabled by default. Log on to the eascmd client and use the cronscale subcommand to enable or update the feature. For more information about logging on to the eascmd local client, see Download and authenticate the client.

Command format (Windows 64-bit example)

eascmdwin64.exe cronscale [region]/[service_name] -s cronscale.json

Before running the command, configure the cronscale.json file according to the parameter descriptions. The following code is a sample cronscale.json configuration.

{
  "ExcludeDates": ["* * * * * 6,0"],
  "ScaleJobs": [
    {
      "Schedule": "0 15,45 * * * *",
      "TargetSize": 6
    },
    {
      "Schedule": "0 0,30 * * * *",
      "TargetSize": 1
    },
    {
      "Schedule": "0 7,22,37,52 * * * *",
      "TargetSize": 3
    }
  ]
}

Parameter name

Description

Example

ExcludeDates

Times to exclude from the schedule, specified as a cron expression. For more information, see Cron expressions.

Note

If a cron expression in ScaleJobs matches an expression in ExcludeDates, the ScaleJobs task is not executed.

["* * * * * 0,6"]

Scheduled scaling tasks are not executed on Saturdays or Sundays.

ScaleJobs

Scheduled scaling tasks to execute. Tasks include Schedule, TargetSize, and Name parameters:

  • Schedule: Time to execute the task. This is a cron expression. For more information, see Cron expressions.

  • TargetSize: Target number of replicas.

  • Name: A custom name for the task. This parameter is optional.

    The Name parameter must follow these rules:

    • Can contain only letters and numbers.

    • Maximum 20 characters.

[ { "Schedule": "0 0 18 * * *", "TargetSize": 10, "Name": "scale-up" }, { "Schedule": "0 0 22 * * *", "TargetSize": 3, "Name": "scale-down" }]

Scales out to 10 replicas at 18:00 every day and scales in to 3 replicas at 22:00 every day.

View configurations

Command format (Windows 64-bit example)

eascmdwin64.exe cronscale show [region]/[service_name]
[RequestId]: F4C38D2D-4B38-5CB7-B706-9A1C41D4617E
+--------------+----------------------------+---------+------------+----------------------+
|     NAME     |          SCHEDULE          |  STATE  | TARGETSIZE |    LASTPROBETIME     |
+--------------+----------------------------+---------+------------+----------------------+
| scale-jobs-1 | 0 5,15,25,35,45,55 * * * * | Succeed |          1 | 2022-03-03T13:45:00Z |
| scale-jobs-0 | 0 0,10,20,30,40,50 * * * * | Succeed |          4 | 2022-03-03T13:50:00Z |
+--------------+----------------------------+---------+------------+----------------------+

Disable scheduled auto scaling

Command format (The Windows 64-bit version is used as an example)

eascmdwin64.exe cronscale rm [region]/[service_name]

Compatibility between scheduled and horizontal auto scaling

Scheduled Scaling (Cronscaler) can be enabled at the same time as Horizontal Auto Scaling (Autoscaler). When both are enabled, Cronscaler modifies the min or max values of Autoscaler.

Important

Although Cronscaler permanently modifies the Autoscaler configuration, the original Autoscaler configuration remains in effect until the next scheduled scaling event. Each time the service is updated or upgraded, the Autoscaler configuration reverts to its original settings.

When Cronscaler and Autoscaler are enabled simultaneously, the min and max values are determined by the rules in the following table.

Horizontal auto scaling min/max

Scheduled auto scaling

Current number of replicas

Final result

Description

1/10

5

5

  • Horizontal (min/max): 1/10

  • Number of replicas: 5

If target matches current replica count, no change occurs.

1/10

4

5

  • Horizontal (min/max): 1/10

  • Number of replicas: 5

If target is lower than current replica count, count is retained.

1/10

6

5

  • Horizontal (min/max): 6/10

  • Number of replicas: 6

  • When target replica count in Cronscaler exceeds current replica count, Cronscaler target is retained.

  • When Cronscaler target exceeds Autoscaler minimum, Autoscaler lower limit is modified.

5/10

4

5

  • Horizontal (min/max): 4/10

  • Number of replicas: 5

  • When Cronscaler target is lower than current replica count, current replica count is retained.

  • When Cronscaler target is lower than Autoscaler minimum, Autoscaler lower limit is modified.

5/10

11

5

  • Horizontal (min/max): 11/11

  • Number of replicas: 11

  • When Cronscaler target exceeds current replica count, Cronscaler target is retained.

  • When Cronscaler target exceeds Autoscaler maximum, Autoscaler upper limit is modified.

Cron expressions

Scheduled Scaling uses cron expressions to define schedules.

Cron expressionCron expression

  • Special characters

    • Asterisk (*)

      Asterisk (*) represents any value. For example, 0 0 0 1 * * represents 00:00 on the first day of each month.

    • Hyphen (-)

      Hyphen (-) represents a continuous range of values. For example, 0 0 12-14 * * * represents 12:00, 13:00, and 14:00 every day.

    • Comma (,)

      Comma (,) represents multiple discrete values. For example, 0 0 12,14 * * * represents 12:00 and 14:00 every day.

    • Slash (/)

      Slash (/) represents an incremental interval. For example, 0 */15 * * * * triggers an event at 0, 15, 30, and 45 minutes past each hour. Combine slash (/) with hyphen (-). For example, 0 5-40/15 * * * * triggers an event every 15 minutes from minute 5 to minute 40 of each hour. Valid time points are 5, 20, and 35 minutes past the hour.

  • Time parameter descriptions

    Name

    Available value

    Available special character

    Second

    0-59

    * / , -

    Minute

    0-59

    * / , -

    Hour

    0-23

    * / , -

    Day

    1-31

    * / , -

    Month

    1-12 or JAN-DEC

    * / , -

    Week

    0-6 or SUN-SAT

    * / , -

FAQ

  1. How do I use scheduled scaling to automatically start and stop a service?

    Scale replica count up from zero and back down to zero to effectively start and stop a service.

    Configure two separate scheduled tasks:

    • Scale-up (Start): Create a task to scale Expected Instances to 1 at your desired start time (e.g., 8:00 AM).

    • Scale-down (Stop): Create a second task to scale Expected Instances to 0 at your desired stop time (e.g., 8:00 PM).

    Service runs and incurs costs only during active hours.

    image

    image

References

  • To automatically scale replicas based on defined metrics, enable horizontal auto scaling. For more information, see Horizontal auto scaling.

  • To ensure service scaling is not limited by machine resources in your dedicated resource group, use the EAS elastic resource pool. For more information, see Elastic resource pool.