Memory usage for deployed Node apps

10 months ago

Hi! I have deployed two Node apps (a Next.js frontend and a Nest backend) about two weeks ago. Each app has about 300-400 MB of constant memory usage, which I believe is expected in Node apps. However, in the pricing about 90% of my current usage comes from memory usage, whereas CPU, disk and network usage contribute very little to the total.

For some reason, I imagined each component would contribute a similar amount to the total - having a large 'gap' like this may be a sign that there's something wrong, especially since my projects aren't large. But memory may well be the largest contributing factor in most projects(?) - I'm not sure since this is my first project deployed with Railway.

Also, there don't seem to be any memory leaks happening - the line just remains flat all the time, with small fluctuations.

So, I'd just like to ask, is this price 'discrepancy' is expected for Node apps - has anyone else dealt with this in their projects - or am I doing something terribly wrong? Thanks!

0 Replies

10 months ago

333f0a15-0fd0-46be-8d54-a043c9893a2e


10 months ago

from my experience the vast majority of apps are going to have a high memory to cpu ratio, and 300 to 400 is right around what other people average for next and nest apps, so I can assure you there's nothing wrong here!


10 months ago

alright, glad to hear that! 😄


10 months ago

I was playing around with the settings and found out you can set a memory usage limit per service, however it only goes as low as 1GB so I think it would not help much there

1266889581421265200


10 months ago

it would also crash loop your app if you could set it to say 200MB


10 months ago

yeah, not a very good idea probably haha


10 months ago

There's also app sleeping, would this be a viable option if my web service doesn't receive too much traffic?

1266889972074418200


10 months ago

yes but please keep in mind there are many things that can't go to sleep for many reasons


10 months ago

yep, alright!


10 months ago

let me know if you have any more questions about anything!


10 months ago

sure!


10 months ago

thanks a lot 😄


10 months ago

no problem!