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
Project ID:
93ff8b35-df80-4f04-9f54-b6e4fa647fbf
93ff8b35-df80-4f04-9f54-b6e4fa647fbf
are you running it with pm2 when on railway?
oh, no
okay that's a good thing
how are you having railway run your app
I use the default scripts from create-next-app , so "next build" "next start", railway runs those after I update my github repo
@Vin is 370mb bad for a next app?
next version is 14
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.mmm, it does after I redeploy the instance (because of repo updates) but after some days it becomes stable I would say
this is the graph for the last 30 days
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
A default next app will use roughly 100MB, so, depending on complexity, this could be extremely normal
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
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
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