Memory usage for deployed Node apps
bentroen
HOBBYOP

2 years 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!

13 Replies

bentroen
HOBBYOP

2 years ago

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


brody
EMPLOYEE

2 years 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!


bentroen
HOBBYOP

2 years ago

alright, glad to hear that! 😄


bentroen
HOBBYOP

2 years 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


brody
EMPLOYEE

2 years ago

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


bentroen
HOBBYOP

2 years ago

yeah, not a very good idea probably haha


bentroen
HOBBYOP

2 years ago

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

1266889972074418200


brody
EMPLOYEE

2 years ago

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


bentroen
HOBBYOP

2 years ago

yep, alright!


brody
EMPLOYEE

2 years ago

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


bentroen
HOBBYOP

2 years ago

sure!


bentroen
HOBBYOP

2 years ago

thanks a lot 😄


brody
EMPLOYEE

2 years ago

no problem!


Loading...