Running

Autoscaling

Scale an app's web replicas up and down with its CPU and requests, between a minimum and a maximum.

Turning it on

The app's Settings tab (Autoscaling), or GET/PUT /api/apps/{id}/autoscale: on or off, the fewest and most replicas (1 to 64), and targets:

  • CPU per replica, 5% to 500%: a share of its CPU limit, or of one core without one;
  • requests a second per replica.

At least one target. While it's on, the app's replica count is the autoscaler's (it's brought within the bounds at once). Previews don't scale.

How it decides

CPU is averaged over the last 3 minutes, requests over the last 2. For each target, the replicas wanted are those running times the metric over the target, rounded up, with nothing changing within 10% of the target; the larger of the two wins, within the bounds and the servers online (one replica a server). An app mid-deploy, or with nothing running, is left alone.

Scaling up happens as soon as it's wanted, two minutes after the last change at the soonest. Scaling down goes to the most wanted over the last five minutes, so a dip doesn't scale it down only to scale it up again.

With a server pool, servers are added when the app wants more replicas than there are servers.

What a change does

A change starts or stops only the difference, at the image the web replicas run: no release command, processes untouched, the replicas already running left as they are. New ones are routed to once healthy; the surplus (those not healthy first, then the newest) stops after the usual 5-second drain (health checks), so scaling drops no requests. Each change is in the audit log as the Autoscaler's, with why, and on the app's card.