n8n icon indicating copy to clipboard operation
n8n copied to clipboard

High CPU usage and unresponsive dashboard after running long Loop workflow

Open Polonco opened this issue 2 months ago • 1 comments

Bug Description

I am self-hosting n8n using Docker on a DigitalOcean droplet with the following specifications:

Regular Intel droplet (1 vCPU, 1 GB RAM) OS: Ubuntu 22.04

I encountered an issue when running a workflow designed to loop approximately 3,000 times.

Workflow Details:

  1. The workflow sends a photo (fetched from a URL) and a message to a Telegram user.
  2. It waits 10 seconds, then repeats the process for the next Telegram user.
  3. The loop continues for all 3,000 Telegram user IDs.

Observed Behavior:

  • After approximately 1,000 iterations (450 minutes of runtime), the CPU usage and server load increased significantly.
  • The n8n dashboard became unresponsive.
  • Other workflows also became extremely slow to execute.
  • The workflow started at 15:30 and was manually stopped at around 23:00 due to these issues.

image

Workflow start at 15:30. I manually stopped it at about 23:00 image

To Reproduce

  1. Extract 3,000 Telegram user IDs.
  2. Create a workflow with a loop that:
  3. Sends a Telegram message with a photo (hosted on a website and fetched via URL).
  4. Waits 10 seconds.
  5. Sends the same content to the next user.
  6. Monitor the server performance during the workflow execution.

Expected behavior

Expected behavior

  • The server load and CPU usage should remain stable even during long-running workflows.
  • The n8n dashboard and other workflows should remain responsive throughout.

Actual Behavior:

  • Server load and CPU usage become excessively high after prolonged execution of the workflow.
  • n8n dashboard and other workflows become unresponsive.

Operating System

Ubuntu Linux 22.04

n8n Version

1.72.1

Node.js Version

20.18.0

Database

SQLite (default)

Execution mode

main (default)

Polonco avatar Dec 21 '24 22:12 Polonco