Docs
/

Magic Apps

Regions and scaling

Choose where your app runs, how many instances it keeps, and how it scales with traffic.

Regions

An app runs in one to six regions. Requests go to the nearest region with a ready instance, and to another region when the nearest has none.

  • The web process runs in every region.
  • Workers, the scheduler and the release command run in the first region only. A second copy of each would do every job twice.

Changing regions takes effect at once, without a deploy and without downtime. New regions start first, which takes about 30 seconds; the regions you removed stop once every new one has a ready instance. The app’s address, custom domains and certificates stay the same.

Enabled regions

Besides the regions it always runs in, the web process can have enabled regions. An enabled region starts instances only while it has visitors nearby, and removes them 5 to 6 minutes after the last request. A handful of requests is enough to start one. While they run, they keep the same minimum and maximum as any other region, and are billed the same.

Instances

Process Instances
Web A minimum and a maximum, per region. Scales between them on its own
Worker A fixed number
Scheduler Always one

Changing the number of instances applies at once, without a deploy.

Each instance can use up to 8 CPU cores and 32 GB of memory. You’re billed for what it actually uses, not for the ceiling.

Autoscaling

The web process adds an instance when its instances use about 70% of their 8 cores, and removes it about a minute after the load stops.

Crashes and restarts

A process that exits is restarted in about 30 seconds. With one instance, a crash means downtime until it’s back. With two or more, the others keep serving: a minimum of two web instances avoids downtime from a single crash.

Deploys

A deploy replaces every instance of every process, one at a time. Each new instance starts before the old one it replaces is removed, so a process never runs below its count. See Deploys and rollbacks.

Processes with a volume

A process with a volume runs exactly one instance, in one region, with no enabled regions.