Skip to content

Autoscaling

FastAPI Cloud can run multiple replicas of your app and adjusts how many are running based on traffic. Autoscaling settings let you control the bounds of that behavior: how far down your app scales when it’s idle and how far up it scales under load.

Scale to zero is on by default. When your app stops receiving traffic it scales down to zero replicas, and it automatically starts again on the next request. Your app only uses compute while there is traffic to serve. Scale to zero will save you usage costs.

Because an app that has scaled to zero has no replica running, the first request after an idle period might take a little longer while a replica starts up. This is known as a cold start. To avoid cold starts, keep at least one replica running.

The replica bounds you can set are determined by your team plan.

PlanMinimum replicasMaximum replicas
HobbyAlways 01 to 3
Pro0 to 101 to 10

Hobby apps always scale to zero when idle, and the minimum cannot be raised. Pro teams can set a minimum of 1 or more to keep an app always on.

  1. Navigate to your app in the dashboard.
  2. Select Scaling from the sidebar.
  3. Drag the Replicas slider to set the bounds you want.
  4. Click Update.

The current bounds are shown as min – max above the slider, and a description below it explains what the selected bounds mean. Changes are not applied until you click Update.

What the slider lets you edit depends on your plan.

On Hobby, the slider has a single handle that sets the maximum number of replicas. The minimum is pinned to 0, so the app always scales to zero when idle.

On Pro, the slider has two handles, one for the minimum and one for the maximum. The minimum can never exceed the maximum; dragging the minimum past the maximum pushes it back down.

The description below the slider reflects the minimum you have selected:

  • With a minimum of 0, it reads that the app scales to zero when idle to save on compute, and that the first request after idle may take a few seconds to warm up.
  • With a minimum of 1 or more, it reads that at least that many replicas stay running to avoid cold starts.

An app never scales to zero while its minimum is 1 or more, so requests don’t pay a cold start. This requires a Pro team.

  1. Navigate to your app in the dashboard.
  2. Select Scaling from the sidebar.
  3. Drag the minimum handle of the Replicas slider to 1 or more.
  4. Click Update.

The maximum bound controls how far FastAPI Cloud scales your app up under load. Within the bounds you set, scaling is automatic and based on traffic; you don’t need to scale up by hand ahead of an expected spike.

Raising the maximum does not create replicas on its own. It only raises the ceiling, so your app can scale further when traffic calls for it.

To see how many replicas are running at any time, check the Metrics page.