a year ago
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?
1 Replies
a year ago
are you running it with pm2 when on railway?
a year ago
okay that's a good thing
a year ago
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
a year ago
@MantisInABox is 370mb bad for a next app?
a year ago
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
)
mmm, it does after I redeploy the instance (because of repo updates) but after some days it becomes stable I would say
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 year ago
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
a year 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
I see, I'm using dev in local yes, but also I run next start
to test the app before deploying it to production