I need to solve a problem in the memory usage of a next.js application.
To check default memory usage (Memory usage without any user) of a express.js RESTapi we could do this.
Server app via pm2 Check the memory status.
Now we are certain that this app could take 25mb in memory to run.
How could I check the same thing for a next.js application?
We could use npm run dev and npm run start commands to locally serve the production build. But how could we check the default memory usage for this as I did in pm2?
You can monitor any npm script by using --:
pm2 start npm -- start
You could also monitor npm run dev by using:
pm2 start npm -- run dev
You can also pass a --name param to change the default name:
pm2 start --name my-app-dev npm -- run dev
my-app-dev will appear under the name column (e. g. when running pm2 list).
You can learn more in the PM2 official documentation.