ram usage local vs production

Hello, I realized the memory consumption of my nextjs app differs between local and prod, when I run it locally pm2 shows 68mb on memory consumption whereas in production the same app consumes 370mb more or less on average. Is it normal that an app consumes more memory in production than in local?
16 Replies
Percy
Percy9mo ago
Project ID: 93ff8b35-df80-4f04-9f54-b6e4fa647fbf
Ghost Order
Ghost OrderOP9mo ago
93ff8b35-df80-4f04-9f54-b6e4fa647fbf
Brody
Brody9mo ago
are you running it with pm2 when on railway?
Ghost Order
Ghost OrderOP9mo ago
oh, no
Brody
Brody9mo ago
okay that's a good thing how are you having railway run your app
Ghost Order
Ghost OrderOP9mo ago
I use the default scripts from create-next-app , so "next build" "next start", railway runs those after I update my github repo
Brody
Brody9mo ago
@Vin is 370mb bad for a next app?
Ghost Order
Ghost OrderOP9mo ago
next version is 14
Duchess
Duchess9mo ago
New reply sent from Help Station thread:
Does it keep increasing? That's sort of expected as Next caches stuff in memory. It'd also be more pronounced on images (next/image)
You're seeing this because this thread has been automatically linked to the Help Station thread.
Ghost Order
Ghost OrderOP9mo ago
mmm, it does after I redeploy the instance (because of repo updates) but after some days it becomes stable I would say
Ghost Order
Ghost OrderOP9mo ago
this is the graph for the last 30 days
No description
Ghost Order
Ghost OrderOP9mo ago
I know memory usage at the end of the day comes down to the quality of my code or packages I use in my project, but my concern is about the difference between the usage in local vs production
MantisInABox
MantisInABox9mo ago
A default next app will use roughly 100MB, so, depending on complexity, this could be extremely normal
Ghost Order
Ghost OrderOP9mo ago
I see, and is it expected that ram consumption differs between local development and production? it's 65mb when running locally on my pc vs 370mb when running in production
MantisInABox
MantisInABox9mo ago
It will vary yes, but I don't believe it should be that much. But then again, locally, you are using dev which doesn't cache things. In memory cache is what would eat that up
Ghost Order
Ghost OrderOP9mo ago
I see, I'm using dev in local yes, but also I run next start to test the app before deploying it to production I'll check the cache then, thank you for the help guys
Want results from more Discord servers?
Add your server