PandaStack

Autoscaling

Opt-in horizontal scaling for apps — set max_instances and PandaStack adds warm instances when CPU or memory utilization crosses 80%, load-balances requests across them, and scales back in when load drops.

By default an app runs as a single instance. Autoscaling is opt-in: set max_instances (to 2 or 3) and PandaStack adds instances automatically when the app is under load, spreads requests across them, and removes them again when load subsides — never dropping below 1 instance.

Autoscaling is available on paid workspaces. The default max_instances of 1 means autoscaling is off.

Enabling it

Set max_instances when creating the app (POST /v1/apps) or on an existing app with a PATCH:

curl -X PATCH https://api.pandastack.ai/v1/apps/<id> \
  -H "Authorization: Bearer $PANDASTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"max_instances": 2}'

Valid values are 23; set it back to 1 to turn autoscaling off.

How scaling out works

  • Trigger — the app scales out when its average CPU or memory utilization crosses 80%. Utilization is measured from the hypervisor's cgroup meters, sampled every 30 seconds — no in-guest agent, and nothing your app has to report.
  • Warm boot, no cold start — a new instance boots from the app's baked deploy image in about 20 seconds. The image carries the built app, so there is no clone, install, or build step, and the instance serves the same deployment as the primary.
  • Load balancing — requests to the app's URL are balanced across all ready instances.

How scaling in works

  • After roughly 2 minutes under 10% CPU, one instance is removed at a time.
  • The primary instance is never removed, and the count never drops below 1.
  • An instance is not removed if doing so would push utilization back over the scale-out threshold (no flapping).

Scale-in stops at one instance. Going all the way to zero is a separate, per-app mechanism — see scale to zero (auto-hibernate).

Behavior at a glance

BehaviorValue
Opt-inmax_instances on POST/PATCH /v1/apps23; default 1 (off)
AvailabilityPaid workspaces
Scale-out triggerAverage CPU or memory utilization > 80% (hypervisor cgroup meters, 30s samples)
New-instance boot~20s warm boot from the baked deploy image — no cold start
RoutingRequests load-balanced across ready instances
Scale-inOne instance after ~2 min under 10% CPU; never the primary; never below 1; never if removal would re-cross the threshold

On this page