Uncontrollable RabbitMQ

Hi.
I finally got around to writing this question.
I set up a little workflow:

WorkFlow

I added a simple time loop to simulate a 5-second run and left it off.
Put about 30 messages in the queue.
I started the flow, and what do I see?
I see 30 floo running, even though there’s only one listener in the rebbit.

How?
No new messages should be accepted until the current ones are handled in success or error.
This leads to a large uncontrollable load on the server and high LA.

1 Like

n8n starts a new workflow execution for each message it receives. It would currently also technically not be impossible in n8n to wait until the workflow execution finishes and only then start the next one. What would be possible is to implement some kind of a rate limiting that for example just all X seconds a new execution gets started.

If you need that kind of behavior please create a new topic under “Feature Request”.

Rebbit, on the other hand, works by the push mechanism.
While the listener is busy, Rebbit can not send him a new message.
For this reason, it seems to me not right to make a limit to start the listener by time.

WebHook can wait for the last node to execute, why can’t RebbitTrigger do that?

It has technical reasons that are sadly too complex and time-intensive to explain in this context right now.

Not saying it would not be possible to do, just saying that it would need core changes that would need more time and are so very unlikely to happen now, as we simply have many more high priority things to work on. We have just limited resources and we have to make sure to work on the things that matter most.

I know what you mean.
I hope you will someday have time to get this task out of the backlog.
I think that in the queue nodes documentation, you should warn users that with a large flow of messages, the load will be uncontrollable.

Hi Jan,

Can you specify more detail about how to implement rate limiting?
I could not find any delay node within n8n.

Fan

Welcome to the community @fanshaohua-fan !

There is currently none (is wip), but that is also not even needed here. You could in the simplest case just read one message at a time and after each message you wait for a certain amount of time before emitting it.

@jan , Thanks for the quick response.

If I understand you correctly, I should modify the RabbitMQTrigger.node.ts file by adding some wait logic around emitting(line: 138).
similar as the comment you made on 7051

Yes, that is correct. That sound then make sure that n8n does not get totally overloaded. You can then set the values depending on the size of your instance and how long those executions run.

I see it was done, in one of the releases.
Th!
image

Ah yes. That got implement a few weeks ago. Now you can also select that only one message at a time gets processed.

Will you be able to add something like this to Kafka Trigger?