Black Friday: Save 10% for life on all of our VPS plans, now through Cyber Monday

10% off on selected plans for as long as you keep the service · new orders · up to 10 uses per customer · ends Dec 1, 2026, 12:00 AM EST.

See plans
Guideschevron_rightServers

Servers · 10 min read · Updated

How to Scale n8n with Queue Mode and Workers

To scale n8n, set EXECUTIONS_MODE=queue on the main instance and on every worker, connect them all to the same PostgreSQL database and Redis, give them the same N8N_ENCRYPTION_KEY, and start workers with n8n worker. The main instance then queues executions and the workers run them. For heavy webhook traffic, add webhook processors with n8n webhook and send /webhook/ paths to them.

When You Need It

A single n8n container, as in self-hosting n8n on a VPS, runs every execution in one process. That is plenty for most teams. Queue mode is worth the extra parts when long or heavy workflows delay others, when webhooks arrive in bursts, or when you want executions to carry on if one process fails.

The parts of an n8n queue-mode setup
PartWhat it doesHow many
Main instanceEditor, triggers, schedules; puts executions on the queueOne (several only with multi-main)
RedisThe queue between main and workersOne
PostgreSQLWorkflows, credentials, execution historyOne, with backups
WorkersRun the executionsAs many as you need
Webhook processorsAnswer production webhooksOptional

1. Move Your Workflows to PostgreSQL

If n8n is running on SQLite now, export everything with n8n's command line before switching, then import it into the new instance once it is running on PostgreSQL:

docker compose exec n8n n8n export:workflow --backup --output=/home/node/.n8n/backup/workflows/
docker compose exec n8n n8n export:credentials --backup --output=/home/node/.n8n/backup/credentials/

The credentials export is encrypted with your current encryption key. Copy that key from /home/node/.n8n/config in the old container: the new setup must use the same one, or the imported credentials cannot be read. Check n8n's CLI documentation for your version, since the export commands have gained options over time.

2. Write the Compose File

In ~/n8n-queue/.env, with your own values:

N8N_ENCRYPTION_KEY=the-key-from-step-1    # or: openssl rand -hex 32 for a new install
POSTGRES_PASSWORD=a-long-random-password
REDIS_PASSWORD=another-long-random-password

And ~/n8n-queue/compose.yaml:

x-n8n: &n8n
  image: docker.n8n.io/n8nio/n8n
  restart: unless-stopped
  environment: &n8n-env
    EXECUTIONS_MODE: queue
    N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
    DB_TYPE: postgresdb
    DB_POSTGRESDB_HOST: postgres
    DB_POSTGRESDB_DATABASE: n8n
    DB_POSTGRESDB_USER: n8n
    DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
    QUEUE_BULL_REDIS_HOST: redis
    QUEUE_BULL_REDIS_PORT: "6379"
    QUEUE_BULL_REDIS_PASSWORD: ${REDIS_PASSWORD}
    GENERIC_TIMEZONE: America/New_York
  depends_on: [postgres, redis]

services:
  postgres:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_DB: n8n
      POSTGRES_USER: n8n
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - pg_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --requirepass ${REDIS_PASSWORD}
    volumes:
      - redis_data:/data

  n8n:
    <<: *n8n
    ports:
      - "127.0.0.1:5678:5678"      # reached through Nginx only
    environment:
      <<: *n8n-env
      N8N_HOST: n8n.example.com
      N8N_PROTOCOL: https
      N8N_WEBHOOK_URL: https://n8n.example.com/
      WEBHOOK_URL: https://n8n.example.com/     # the name before n8n 2.30

  worker:
    <<: *n8n
    command: worker --concurrency=10

volumes:
  pg_data:
  redis_data:
cd ~/n8n-queue
docker compose up -d
docker compose logs -f worker      # the worker reports it is waiting for jobs

Nothing but the main instance publishes a port, and only to the server itself. Put Nginx and HTTPS in front of it as in the single-server guide, then import the workflows and credentials from step 1.

3. Add Workers

On the same server, more workers are one command:

docker compose up -d --scale worker=3

Watch memory with docker stats while your heaviest workflows run: each worker is a full n8n process. To run workers on another server, copy the x-n8n block and the worker service there, point DB_POSTGRESDB_HOST and QUEUE_BULL_REDIS_HOST at the first server, and keep PostgreSQL and Redis off the public internet. Between our servers in the same location, private networking carries that traffic; elsewhere, use WireGuard.

Manual runs from the editor still execute on the main instance. Set OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true on it to send them to workers too.

4. Optional: Webhook Processors

Webhook processors take production webhook calls off the main instance. Add a service like the worker with command: webhook and 127.0.0.1:5679:5678 as its port, then route by path in Nginx. Test webhooks (/webhook-test/) must still reach the main instance:

location ~ ^/(webhook|webhook-waiting)/ {
    proxy_pass http://127.0.0.1:5679;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

location / {
    proxy_pass http://127.0.0.1:5678;      # editor, API and /webhook-test/
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
}

With several processors, list them in an Nginx upstream block. To stop the main instance answering production webhooks itself, set N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true on it.

5. Health Checks and Updates

  • Health: set QUEUE_HEALTH_CHECK_ACTIVE=true on workers and they answer /healthz (running) and /healthz/readiness (database and Redis connected) on port 5678. Uptime Kuma can watch them.
  • Updates: main and workers should run the same n8n version. Pull and restart them together with docker compose pull && docker compose up -d, after a database backup.
  • Backups: PostgreSQL now holds everything; dump it nightly as in backing up a database to S3, and keep the encryption key somewhere safe and separate.
  • Binary data: in queue mode, files passing through workflows are kept in the database by default, which grows it. Workflows that handle large files are better kept small, or moved to external storage if your n8n licence includes it.

Beyond One Main Instance

Queue mode leaves one main instance. n8n's multi-main setup runs several behind a load balancer with sticky sessions, all in queue mode on the same PostgreSQL and Redis, with N8N_MULTI_MAIN_SETUP_ENABLED=true. It is a self-hosted Enterprise feature and needs a licence. For most teams, queue mode on a dedicated server or two VPSes, plus tested backups, is the practical stopping point.

Common Questions

  • What is n8n queue mode?

    A way of running n8n where the main instance only receives triggers and webhooks and puts each execution on a Redis queue. Separate worker processes take executions from the queue and run them, so you add capacity by adding workers, on the same server or others.

  • Can I use queue mode with SQLite?

    n8n's documentation says running queue mode on SQLite isn't recommended, and that a distributed setup on SQLite isn't supported. Workers on other servers cannot reach a SQLite file, so move to PostgreSQL first.

  • Is queue mode the same as high availability?

    Not quite. Queue mode keeps executions running when one worker fails, but there is still one main instance: if it stops, triggers and the editor stop. Running several main instances is n8n's multi-main setup, which its documentation lists as a self-hosted Enterprise feature that needs a licence.

  • How many executions does a worker run at once?

    Ten by default. Change it with the --concurrency flag. n8n recommends 5 or more, and warns that many workers with low concurrency can use up the database's connection pool.

Plans and prices

VPS Plans

KVM servers with NVMe storage and full root access for self-hosted n8n.

See all plans
  • Bronze

    3 vCPU · 6 GB RAM · 75 GB NVMe

    2 TB transfer

    $37.50/mo

    Configure inAshburnDallas
  • Silver

    4 vCPU · 8 GB RAM · 100 GB NVMe

    4 TB transfer

    $46.50/mo

    Configure inAshburnDallas
  • Gold

    6 vCPU · 12 GB RAM · 150 GB NVMe

    6 TB transfer

    $60.00/mo

    Configure inAshburnDallas
  • Diamond

    8 vCPU · 16 GB RAM · 200 GB NVMe

    8 TB transfer

    $73.50/mo

    Configure inAshburnDallas

Network port: 10 Gbps in Ashburn, VA, 50 Gbps in Dallas, TX. Pick the location when you configure.

See n8n VPS plans

Keep Reading

All guides