Skip to Content

Scaling

Set how many instances of a service run, let it autoscale on CPU or memory.

Settings → Scale holds two cards: Scale ("How many copies of this service run.") and Sleep mode.

Scale: Autoscale Off, Instances 1, and Sleep mode Off
Scale: Autoscale Off, Instances 1, and Sleep mode Off

Instances

Instances is the number of copies that run, set with − and +. The card says how many your plan allows, for example "Up to 10 instances on your plan." The limit per plan:

PlanInstances per service
Trial1
Developer1
Pro3
Business10

Add an instance

Click +. The row reads 2 instances.

Instances: 2 instances
Instances: 2 instances

Commit and deploy

Click Commit 1 change. The dialog lists Web instances 1 → 2. Click Deploy 1 change. A minute later both instances are running and ready.

1 change to apply: Web instances 1 → 2
1 change to apply: Web instances 1 → 2

Autoscale

Turn on Autoscale in the Scale header. The fixed count is replaced by a range and the metrics to scale on:

  • Instances: Min and Max. Both start at the current number of instances. If you set Min above Max, Max moves up with it.
  • Scale up when…: CPU and Memory, each with a switch and a target in "% average utilization". Both targets start at 80. CPU is switched on for you.
Autoscale On: Min and Max, CPU above 80% on, Memory off
Autoscale On: Min and Max, CPU above 80% on, Memory off

Switching on Memory adds a warning: "Memory-based scaling can be one-way: heap-holding runtimes (JVM, Node) rarely release memory, so instances may never scale back down."

Memory switched on, with the one-way scaling warning
Memory switched on, with the one-way scaling warning

With both switched off, the card says "No metric selected — autoscaling is inactive".

No metric selected — autoscaling is inactive
No metric selected — autoscaling is inactive

Set the range and the target

Here: Min 1, Max 3, CPU above 70.

Autoscale: Min 1, Max 3, CPU above 70%
Autoscale: Min 1, Max 3, CPU above 70%

Commit and deploy

The dialog lists Autoscaling off → on and Web autoscale range 0–0 → 1–3. Click Deploy 1 change. The saved service has a range of 1 to 3 instances and a CPU target of 70%.

1 change to apply: Autoscaling off → on, Web autoscale range 0–0 → 1–3
1 change to apply: Autoscaling off → on, Web autoscale range 0–0 → 1–3

Limits of the fields

  • CPU and Memory targets go from 10 to 90, in steps of 5. Typing 5 or 95 marks the field invalid ("Value must be greater than or equal to 10.", "Value must be less than or equal to 90.").
  • Min and Max go from 1 to 10. Your plan's limit per service still applies.
  • At your plan's limit, when a bigger plan allows more, an Upgrade tag appears next to Scale: "Your plan's instance limit per service is reached." On Trial and Developer, which allow one instance, there is nothing to scale between.

When autoscale is on, a worker gets its own Worker process Min and Max, with the warning "Scales on CPU/memory, not queue depth. For queue-driven workers, prefer setting instances manually."

A worker process next to the web process

A web service can also run a worker process: a second set of instances from the same image, with no port and no traffic. There is no switch for this in the dashboard. Add it from the CLI:

stackblaze scale web=1 worker=1 -a crondemo

The CLI said web → 1 instance(s) and worker → 1 instance(s) (was 0). Scale then shows a Worker process row ("1 instance · background") under Instances, with its own − and +, up to 10. The worker process ran the service's start command, the same as the web process.

Scale: Instances 1 and Worker process 1 instance · background
Scale: Instances 1 and Worker process 1 instance · background

With autoscale on, it has its own range:

Autoscale on: Instances Min 1 Max 3, Worker process Min 1 Max 1, CPU above 70%
Autoscale on: Instances Min 1 Max 3, Worker process Min 1 Max 1, CPU above 70%

From the CLI

stackblaze scale changes both processes in one release:

CommandWhat it does
stackblaze scale web=3Run 3 web instances
stackblaze scale web=2 worker=1Set both processes at once
stackblaze scale --autoscale web=2:5Autoscale between 2 and 5 web instances
stackblaze scale --autoscale-off webBack to a fixed number

Counts are checked against your plan's limit per service. See stackblaze scale.

In stackblaze.yaml

In stackblaze.yaml, a service takes numInstances for a fixed number, or a scaling block with minInstances, maxInstances, targetCPUPercent and targetMemoryPercent.

Before you add instances

Requests are spread over all instances, so any of them can get the next request from the same visitor. Keep state out of the instance:

  • Keep sessions and caches that all instances must see in Valkey or in your database, not in memory.
  • Keep files on a volume, which every instance mounts, not on the container's own disk.
  • Every instance opens its own database connections. Size the database's connection limit for Max instances, not for one.

Instance size

The panel header shows the service's instance size, for example Small. Settings has no control to change it.

On this page