Module 2 Lesson 4: Scaling n8n
·Automation

Module 2 Lesson 4: Scaling n8n

Handle the load. Learn how to switch from a 'Main' process to 'Queue Mode' using Redis workers to handle thousands of concurrent automations.

Module 2 Lesson 4: Scaling n8n

One n8n container can handle hundreds of tasks a day. But if you are processing 10,000 leads an hour, the UI will become slow and the tasks might "Time out." This is where Queue Mode comes in.

1. The Standard Mode

One process does everything:

  • Shows the UI.
  • Listens for Webhooks.
  • Executes the code. Problem: If a heavy job is running, the UI freezes.

2. Queue Mode (The Scaled Way)

You divide the work between three specialized components:

  1. n8n Main: Only handles the UI and API.
  2. n8n Worker: Only handles the actual execution of workflows. (You can have 10 of these!).
  3. Redis: The "Message Broker" that holds a list of tasks waiting to be done.

3. The Architecture

  • The Main Process puts a "Job" into Redis.
  • The First Free Worker pulls that job from Redis and executes it.
  • When finished, the worker sends the result back to the database.

4. Enabling Queue Mode

You change your EXECUTIONS_MODE and connect to Redis:

environment:
  - EXECUTIONS_MODE=queue
  - QUEUE_BULL_REDIS_HOST=redis
  - QUEUE_BULL_REDIS_PORT=6379

Exercise: The Worker Audit

  1. Research: What is "Bull" in the context of Node.js? (Hint: It's the library n8n uses for the queue).
  2. If one worker has 1GB of RAM, and a job needs 2GB, what happens? How does having 5 workers help?
  3. Draw a diagram showing how data moves from a Webhook -> Main -> Redis -> Worker.
  4. Why is a Postgres database (Module 2, Lesson 3) required for Queue Mode?
  5. Search: How do you tell n8n to "Keep only the last 100 executions" to save database space?

Summary

Scaling n8n is about Separation of Concerns. By using Queue Mode with Redis, you ensure that your automation "Engine" is powerful enough to handle any load while keeping your "Dashboard" fast and responsive.

Next Lesson: Safety first: Backups and Migration strategies.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn