Hi!
I am using hosting n8n with worker template, consisting of primary, worker, redis and postgres on Railway.
When my instance goes idle, the RAM constantly uses 2GB of RAM, mainly the worker, using most of the RAM, causing a big charge.
Has anyone had experience with this? Is this normal? How can I reduce the RAM usage when idle?
Take a look at this suggestion below and see if it makes sense to you.
Set N8N_WORKER_THREADS=1 and keep workflows and automatic triggers running as few as possible.
Disable automatic triggers/polling
Workflows with “cron” or polling triggers consume RAM.
Disable or reduce the frequency of triggers that you do not need an immediate response to.
Use ‘main’ mode (without a separate worker)
Node memory limit
In Railway, limit by variables
NODE_OPTIONS=–max_old_space_size=256
You can also configure automatic restart when memory reaches a certain value.
In the Railway variables panel, you can add the suggestion below;
If this suggestion solved your problem, please mark my post as solved (blue box with check mark) so that this ongoing discussion does not distract others who want to find the answer to the original question and hit the heart button . Thanks
Thanks for your information, I would like to ask a bit more.
When I set worker thread to 1 is that mean n8n will not process more than 1 request concurrently? which make it the same as using main mode rather than queue mode?
Answer to question - When I set the worker thread to 1, does that mean that n8n will not process more than one request simultaneously?
With N8N_WORKER_THREADS=1, you limit yourself to ONE processing per worker at a time, but you still use the queue/distribution architecture.
Answer to question - What makes this the same as using main mode instead of queue mode?
In main mode, you eliminate the complexity of the queue and the separate worker, running everything in a single process.
Both only process ONE job at a time if configured this way, but worker mode still requires more minimal resources due to the architecture, even using only one worker.