By default, n8n runs in "main" mode where the same process handles the UI, webhook reception, and workflow execution.
By default, n8n runs in "main" mode where the same process handles the UI, webhook reception, and workflow execution. Queue mode separates these concerns: the main process handles the UI and webhook ingestion, while dedicated worker processes execute workflows via a Redis-backed queue.
Real-world example: A data platform processes 50,000 webhook events per hour. In main mode, heavy workflow executions block the webhook endpoint, causing event loss.
# Main process .env
EXECUTIONS_MODE=queue
QUEUE_BULL_REDIS_HOST=redis
QUEUE_BULL_REDIS_PORT=6379
QUEUE_BULL_REDIS_PASSWORD=your-redis-password
QUEUE_HEALTH_CHECK_ACTIVE=true
```text
```yaml
# docker-compose.yml for queue mode
services:
redis:
image: redis:7-alpine
command: redis-server --requirepass your-redis-password --maxmemory 512mb
volumes:
- redis_data:/data
n8n-main:
image: n8nio/n8n:latest
command: n8n start
environment:
- EXECUTIONS_MODE=queue
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_BULL_REDIS_PORT=6379
- QUEUE_BULL_REDIS_PASSWORD=your-redis-password
ports:
- "5678:5678"
n8n-worker-1:
image: n8nio/n8n:latest
command: n8n worker
environment:
- EXECUTIONS_MODE=queue
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_BULL_REDIS_PORT=6379
- QUEUE_BULL_REDIS_PASSWORD=your-redis-password
- N8N_CONCURRENCY_PRODUCTION_LIMIT=10
n8n-worker-2:
image: n8nio/n8n:latest
command: n8n worker
environment:
- EXECUTIONS_MODE=queue
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_BULL_REDIS_PORT=6379
- QUEUE_BULL_REDIS_PASSWORD=your-redis-password
- N8N_CONCURRENCY_PRODUCTION_LIMIT=10
volumes:
redis_data:
```text
Scale workers horizontally based on your throughput needs. Each worker can process multiple executions concurrently based on the concurrency limit.
**Related:** [Flatten Deeply Nested API Responses](../code-node-mastery/01-flatten-deeply-nested-api-responses.md) | [Use Docker Compose with Health Checks for n8n and PostgreSQL](../self-hosting-operations/01-use-docker-compose-with-health-checks-for-n8n-and-postgresql.md)
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.