How to excute multiple nodes in parallel not sequential

Hello,
I’m trying to run multiple workflows in parallel, right now, it only runs the first workflow, and the others need to wait till the first workflow ends to start the second workflow.

the workflow

I’m using n8n in self-hosted Docker in Oracle OCI in ARM 4vCPU + 24GB Ram
and that’s the only use of the machine to run n8n !
so let me know if i need to change the execution mode or execution process to make it work!

A workaround for this task, I’ve made it like this, to make them all run at a specific time.
PS: the workflow is only HTTP requests and telegram send chat and repeated for multiple accounts so all workflows have the same structure as this :

and here is the workaround workflow

Information on your n8n setup

  • **n8n version: 0.217.2
  • **Database you’re using (default: SQLite): SQLite
  • **Running n8n with the execution process [own(default), main]:main
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]:Docker

Hey @MotazHakim - there is no “official” way to execute in parallel instead of sequentially. So the only way would be to use some sort of workaround like yours (although if milliseconds matter to your usecase, I would not rely on the fact that all subworkflows execute at the same exact ms)

n8n is simply designed to execute nodes in a workflow in a sequence and there is nothing planned right now on our roadmap to change that. Of course, you can create a feature request here on the forums to petition to add that in. I can imagine that could be a very big change to core execution logic; so if you do petition to add it, I’d recommend giving some context to why it’s really necessary for certain types of usecases (not saying it isn’t, just that it would be helpful given it’s non-trivial work to implement).

In theory, you can just call a sub workflow with a webhook trigger (with the option “Respond” set to Immediately) which gets called by a http request node.

I haven’t tried that yet myself, but that should work. At least on the surface, I do not know how n8n handles multiple workflows executed at the same time.

@FelixL @MotazHakim
This method seems to work quite decently for me.

I’ve gone up to executing 25-30 sub-workflows in parallel.

In my case, that’s where a comfortable threshold was established, with regards to the max resource consumption by the subworkflow in question and n8n not crashing.

Example, in the main workflow:

Here, the Split In Batches node’s Batch Size is set to 25.
And the Code1 node’s code is set to return {}; in the Run Once for All Items mode just so as not to trigger the IF node multiple times.

Note: this arrangement becomes a serious necessity at times, whenever a large set of data needs to be processed and without parallelization, it would easily take upto 15-30 times longer!

3 Likes

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