Dealing with memory problems

Describe the problem/error/question

Hi Guys!

im trying to update some information via API request, after the request, i got about 12.5k itens in the node.
To reduce this data amount i’ve started using MariaDB to store the data amount.
So when i need data, i make a select to retrive those items, make a loop for send via another http request and after store a log in a table of mariadb

But, my workflow stops, in SQL executions sometimes they show me memory error and sometimes memory heap.

I tried separate in multiple workflows, flow after flow. for my surprise if i start flow after flow manualy, sometimes works.
With schedule node or another trigger, dont work.

How can i set more memory to my node using npm + pm2 ?

Its possible use Multithreads of my server for one worker?

Theres a possibility of mariadb(MySql) node have a bug?

Information on your n8n setup

  • **n8n version:1.39.1
  • **Database : Postgres
  • n8n EXECUTIONS_PROCESS setting (main):
  • Running n8n via (npm):
  • **Operating system: Linux **
  • ** Using queue mode*

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • **n8n version:1.39.1
  • **Database : Postgres
  • n8n EXECUTIONS_PROCESS setting (main):
  • Running n8n via (npm):
  • **Operating system: Linux **
  • ** Using queue mode*

Hello @MarceloGarciaJr

Without seeing the workflows its hard to say where the bottleneck is.

Generally, you should have such a design:

  1. workflow1 to fetch api and place results in the DB
  2. workflow2 to set the paging properties for the sub workflow3 (start page, next page and so on)
  3. workflow3 (sub for wf2) that will receive the page properties from the parent workflow2, selects the desired page in the db (e.g. receive 20 items with a single query) and work with the results. In the end that wf should pass the next page properties to the parent wf.

That looks quite complicated and you may think why you need it instead of using loops, but the goal here is to perform a “hard” operations for each page (or batch) separately, so the n8n will be able to release the memory after the each execution finishes (i.e. after each portion of results will be processed)

Theres a way to use offset in databases? like a pagination?

Yes, with LIMIT command
LIMIT - MariaDB Knowledge Base

And an example of how it actually can be done (there are also other options on how to implement that)
pagination - MySQL Data - Best way to implement paging? - Stack Overflow

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.