Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM2 + Node.js + Ubuntu: Garbage collection does not work as expected #5843

Open
TimGuendel opened this issue Jun 13, 2024 · 0 comments
Open

Comments

@TimGuendel
Copy link

We are having problems with our Production Nuxt3 app. It runs on PM2 (cluster mode) on an ubuntu VPS. The memory usage keeps growing over time.

When run locally (Node and PM2 installed on Windows or Mac), a stress test does fill the memory, but eventually the garbage collection seems to do its job:

PM2 monit, seconds after the stress test and one hour after the test:
image

When running on ubuntu, the memoy usage stays up. PM2 monit (production server, Ubuntu 22.04.4 LTS, node v20.14.0, PM2 5.4.0) after 17 hours of uptime:
image

As a result, we have to restart PM2 every couple of days. I tried using --optimize_for_size for Node. This reduced the overall memory usage, but not the growth.

I reproduced this behaviour on my Windows PC with WSL. After the stress test the memory usage stayed high. So the culprit must have something to do with Ubuntu. Any ideas? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant