Skip to content

Scale from one process to workers ​

In the single topology, one n8n process does everything: the editor, the triggers and every execution. It is simple and cheap, and it is enough until executions pile up. Then a long workflow slows the editor, or two heavy ones wait for each other. Queue mode fixes this: main puts each execution in a queue, and separate worker processes run them.

This guide shows how to go from single to queue, how workers scale, and when to go further to split or multi-main. The roles and topologies are defined in concepts.

Signs that you need workers ​

  • The editor is slow while workflows run.
  • Executions wait, or time out, during bursts.
  • You want to run many executions at once, or long ones.

The options note suggests single for a trial or personal use, below about 10 executions a minute.

Move to queue mode ​

Queue mode needs PostgreSQL, because SQLite cannot be shared, and a Redis-compatible queue (T1). The medium profile sets all of it.

yaml
profile: medium
topology:
  mode: queue
  workers: {min: 1, max: 8, concurrency: 10, scale_on: queue-depth, target: 20, spot: true}

What changes:

  • Aurora Serverless replaces SQLite, and ElastiCache Serverless provides the queue.
  • Binary data goes to the database, or to S3 with a paid edition. Filesystem data cannot be shared between processes (T4).
  • Workers run on Fargate Spot when spot: true, which is cheaper and safe, because an interrupted job returns to the queue.

If you ran nano with SQLite, move your workflows first. n8n has a command line to export and import workflows and credentials; do it before you change the database, and keep the encryption key (see back up and restore).

The queue-workers sample is a complete file. It costs about $187 a month.

How workers scale ​

With scale_on: queue-depth, a CloudWatch agent next to main publishes the number of waiting and active jobs. Workers scale out when jobs wait, also from zero workers, and scale in when the jobs in flight fit on one worker less for scale_in_minutes. A CPU policy only scales out, as a safety net. On a real account, 180 webhook calls of 30 seconds took the workers from 0 to 3 and back to 0.

scale_on: cpu is simpler but cannot start a worker when none runs, so use it with min: 1 (T16).

Split the webhooks ​

When bursts of webhook calls slow the editor, use topology.mode: split. Webhook processors take /webhook/* and the other public paths, and main keeps the editor and the triggers. It needs a load balancer with path routing, and costs more: the split-webhooks sample is about $993 a month with its NAT gateways, provisioned cache and firewall. See shapes.

Run several main processes ​

multi-main gives you a high-availability editor and triggers, and upgrades without downtime. It needs the Enterprise edition (L7), at least two main replicas, sticky sessions on the load balancer, and it was synthesized and tested but never deployed, because it needs a license. See the enterprise-ha sample.

Check the cost first ​

Every step adds fixed costs: NAT gateways, a load balancer, a cache. Run plan --cost after each change, and set finops.max_monthly_usd to stop a deployment whose estimate is above your limit.