n8n queue mode: scaling with workers
Updated 2026-10-21 · 6 min read
- Queue mode splits n8n: main takes triggers, Redis holds the queue, workers run executions.
- Every process needs EXECUTIONS_MODE=queue, the same encryption key and the same Postgres.
- Each worker needs its own n8nio/runners sidecar, or every Code node on it fails.
Queue mode is how self-hosted n8n grows past one process. The main instance still serves the editor, timers and webhooks. But it no longer runs executions itself. It puts them on a Redis queue, and any number of worker processes pick them up. A worker is a separate n8n process that only runs executions.
This page covers the architecture and the settings every part needs. It has a working Compose example. It also lists the details that break real setups: binary data, task runners and large webhook responses.
Start with a single instance (Docker setup). Move to queue mode when one of these happens:
- executions pile up,
- the editor slows down during heavy runs,
- you need more parallel work than one Node.js process can handle.
What to do now
- Check that you need it. For most migrated projects of a few dozen workflows, one instance is enough.
- Add Redis and one worker. Use the Compose example below on top of your single-instance setup.
- Use one encryption key and one database. Every process gets the same
N8N_ENCRYPTION_KEYand the same Postgres. - Give every worker a runners sidecar. Without one, every Code node on that worker fails.
- Run a test workflow with a Code node. Check that the worker runs it. Our rule of thumb, not n8n's: add workers when one is busy all the time.
How it works
From the queue mode docs:
- The main instance handles timers and webhook calls. It creates an execution but doesn't run it.
- It puts the execution ID on Redis.
- A free worker takes the job from Redis.
- The worker loads the workflow from the database and runs it.
- It writes the result to the database and tells Redis the job is done.
- Redis notifies the main instance.
| Component | Runs | Needs |
|---|---|---|
| Main | Editor, API, triggers, test webhooks | Postgres, Redis |
Worker (n8n worker) |
Production executions | Postgres, Redis, the same encryption key |
Webhook processor (n8n webhook, optional) |
Receives production webhook requests | Postgres, Redis, EXECUTIONS_MODE=queue |
| Redis | The queue | |
| Postgres | Workflows, credentials, executions | SQLite isn't supported here |
Required configuration
Set these on main, workers and webhook processors:
| Variable | Value |
|---|---|
EXECUTIONS_MODE |
queue |
QUEUE_BULL_REDIS_HOST |
Redis host (default localhost) |
QUEUE_BULL_REDIS_PORT |
6379 by default |
QUEUE_BULL_REDIS_PASSWORD |
Only if Redis has a password |
N8N_ENCRYPTION_KEY |
Identical on every process, or workers can't decrypt credentials |
DB_TYPE=postgresdb and DB_POSTGRESDB_* |
The same database everywhere |
Optional, but common:
| Variable | Default | What it does |
|---|---|---|
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS |
false |
Runs manual (editor) executions on workers too |
N8N_GRACEFUL_SHUTDOWN_TIMEOUT |
30 s |
Time workers get to finish their jobs on shutdown |
QUEUE_HEALTH_CHECK_ACTIVE |
off | Turns on /healthz and /healthz/readiness on workers |
N8N_WEBHOOK_URL |
– | Public base URL for webhooks (2.30.0+) |
N8N_DISABLE_PRODUCTION_MAIN_PROCESS |
– | Main stops handling production webhooks when you use webhook processors |
All processes must run the same n8n version.
Compose example
Start from the single-instance file in n8n Docker setup. Add Redis and a worker. Put the queue variables in one shared block:
x-n8n-env: &n8n-env
EXECUTIONS_MODE: queue
QUEUE_BULL_REDIS_HOST: redis
QUEUE_BULL_REDIS_PORT: "6379"
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_DATABASE: ${POSTGRES_DB}
DB_POSTGRESDB_USER: ${POSTGRES_USER}
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
N8N_RUNNERS_MODE: external
N8N_RUNNERS_BROKER_LISTEN_ADDRESS: 0.0.0.0
N8N_RUNNERS_AUTH_TOKEN: ${N8N_RUNNERS_AUTH_TOKEN}
services:
redis:
image: redis:7
restart: always
n8n:
image: n8nio/n8n:${N8N_VERSION}
environment:
<<: *n8n-env
N8N_WEBHOOK_URL: https://n8n.example.com/
ports: ["127.0.0.1:5678:5678"]
depends_on: [postgres, redis]
main-runners: # main still runs manual executions
image: n8nio/runners:${N8N_VERSION}
environment:
N8N_RUNNERS_TASK_BROKER_URI: http://n8n:5679
N8N_RUNNERS_AUTH_TOKEN: ${N8N_RUNNERS_AUTH_TOKEN}
depends_on: [n8n]
n8n-worker:
image: n8nio/n8n:${N8N_VERSION}
command: worker --concurrency=10
environment:
<<: *n8n-env
depends_on: [n8n]
worker-runners:
image: n8nio/runners:${N8N_VERSION}
environment:
N8N_RUNNERS_TASK_BROKER_URI: http://n8n-worker:5679
N8N_RUNNERS_AUTH_TOKEN: ${N8N_RUNNERS_AUTH_TOKEN}
depends_on: [n8n-worker]
Postgres and its volume stay as in the single-instance file. To scale, add more worker services. Each one gets its own runners sidecar.
Task runners in queue mode
A task runner is the separate process that runs Code node code. In Docker it lives in a sidecar container next to n8n. The task runner docs are clear: each worker needs its own runners sidecar.
If OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS is false (the default), the main instance still runs manual executions, so it needs its own sidecar too. A worker without runners fails every Code node. This is the most common queue mode problem on day one. Custom npm or Python packages must be in every runners image.
Worker concurrency
A worker runs 10 executions in parallel by default. Change it with n8n worker --concurrency=N. n8n recommends 5 or higher. The reason: each worker holds database connections, so many workers with low concurrency can exhaust the pool.
Our rule of thumb, not n8n's: add workers once one worker at concurrency 10 to 20 is busy all the time.
Webhook processors
A webhook processor is an extra n8n webhook process that only receives webhook calls. For high webhook volume, run several behind a load balancer:
- Route
/webhook/*and/webhook-waiting/*to the webhook processors. - Route everything else to main. That includes
/webhook-test/*(test runs from the editor). - Don't put main in the webhook pool, because it slows down the editor. You can also set
N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true.
Pitfalls
| Problem | Cause | Fix |
|---|---|---|
| Binary data missing between steps | Filesystem binary storage isn't supported in queue mode | N8N_DEFAULT_BINARY_DATA_MODE=database, or S3 external storage (Business/Enterprise) |
| Credentials fail on workers | A different encryption key | The same N8N_ENCRYPTION_KEY everywhere |
| Code nodes fail on workers | No runners sidecar on the worker | One sidecar per worker |
| "The response is too large to be sent back from the worker" | The Respond to Webhook body is over N8N_WEBHOOK_RESPONSE_RELAY_SIZE_MAX (64 MiB) |
Raise the limit, or offload to storage (2.34.0+) |
| Webhooks slower than before | The request now hops main → Redis → worker | Expected overhead; add webhook processors for volume |
Multi-main (Enterprise)
Queue mode can run several main processes for high availability. One of them is the leader. It runs the work that must happen only once: timers, pollers and pruning. The others (followers) serve the UI and API.
Multi-main needs:
N8N_MULTI_MAIN_SETUP_ENABLED=trueon every main,- Postgres and Redis,
- the same version everywhere,
- a load balancer with sticky sessions.
It is a self-hosted Enterprise feature and isn't available on n8n Cloud.
Do you need it after leaving Pipedream?
Pipedream ran and scaled the infrastructure for you, and you paid per credit. On self-hosted n8n, one instance is enough for most migrated projects of a few dozen workflows. Queue mode matters when you have:
- many high-frequency webhooks,
- long-running Code nodes,
- heavy schedules that overlap.
Before you size anything, look at what you're moving. Our converter report shows trigger types and code steps per workflow. The Code node compatibility check shows what a single step needs. The report and 1 workflow are free. Full export: $3 per workflow, $1 each after 50, $19 minimum, one-off. Then follow migrate Pipedream to n8n.
Not affiliated with Pipedream or n8n.
FAQ
What is queue mode in n8n?
A self-hosted setup in which the main instance receives triggers and webhooks and puts execution IDs on a Redis queue. Separate worker processes run the executions. You scale by adding workers.
Which environment variables enable n8n queue mode?
EXECUTIONS_MODE=queue on the main instance and every worker, QUEUE_BULL_REDIS_HOST and QUEUE_BULL_REDIS_PORT (plus the password, if set), the same N8N_ENCRYPTION_KEY everywhere, and a shared Postgres database.
Can I use SQLite with queue mode?
No. n8n doesn't support running a distributed setup over SQLite. Use Postgres.
How many executions does an n8n worker run at once?
10 by default. Change it with n8n worker --concurrency=N. n8n recommends 5 or higher: many workers with low concurrency can exhaust the database connection pool.
Is queue mode available on n8n Cloud?
On self-hosted n8n you configure it yourself. n8n's pricing page lists queue mode as included on Cloud Enterprise. Multi-main is self-hosted Enterprise; the docs say it isn't available on n8n Cloud.
Sources (4)
- https://docs.n8n.io/deploy/host-n8n/configure-n8n/scaling/enable-queue-mode
- https://docs.n8n.io/deploy/host-n8n/configure-n8n/basic-configuration/use-environment-variables/queue-mode
- https://docs.n8n.io/deploy/host-n8n/configure-n8n/set-up-task-runners
- https://docs.n8n.io/deploy/host-n8n/configure-n8n/scaling/use-external-storage