R
Railwayβ€’4mo ago
Bentroen

Memory usage for deployed Node apps

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!
No description
No description
Solution:
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!
Jump to solution
13 Replies
Percy
Percyβ€’4mo ago
Project ID: 333f0a15-0fd0-46be-8d54-a043c9893a2e
Bentroen
BentroenOPβ€’4mo ago
333f0a15-0fd0-46be-8d54-a043c9893a2e
Solution
Brody
Brodyβ€’4mo 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
BentroenOPβ€’4mo ago
alright, glad to hear that! πŸ˜„
Bentroen
BentroenOPβ€’4mo 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
No description
Brody
Brodyβ€’4mo ago
it would also crash loop your app if you could set it to say 200MB
Bentroen
BentroenOPβ€’4mo ago
yeah, not a very good idea probably haha
Bentroen
BentroenOPβ€’4mo ago
There's also app sleeping, would this be a viable option if my web service doesn't receive too much traffic?
No description
Brody
Brodyβ€’4mo ago
yes but please keep in mind there are many things that can't go to sleep for many reasons
Bentroen
BentroenOPβ€’4mo ago
yep, alright!
Brody
Brodyβ€’4mo ago
let me know if you have any more questions about anything!
Bentroen
BentroenOPβ€’4mo ago
sure! thanks a lot πŸ˜„
Brody
Brodyβ€’4mo ago
no problem!
Want results from more Discord servers?
Add your server