jochen-schweizer / express-prom-bundle

express middleware with standard prometheus metrics in one bundle
MIT License
310 stars 68 forks source link

Package consuming 10gb of virtual memory #88

Closed Pauss closed 3 years ago

Pauss commented 3 years ago

Hello, I'm using this package : express-prom-bundle": "^6.3.6. Recently i've noticed it's consuming ~10gb of virtual memory alone.

Here's my package.json : { "name": "app", "version": "1.0.0", "description": "Test Server for Kubernetes Cluster", "main": "index.js", "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "nodemon index.js" }, "author": "Paula Tanasa", "license": "ISC", "dependencies": { "express": "^4.17.1", "morgan": "^1.10.0", "nodemon": "^2.0.7", "express-prom-bundle": "^6.3.6" } }

Here's the 'top' command log: image

Can you take a look and provide any feedback? Thank you.

disjunction commented 3 years ago

what makes you think the culprit is express-prom-bundle?

Pauss commented 3 years ago

don't know but without this package, virtual memory stays lower than 1mb image

disjunction commented 3 years ago

The library requires a peer dependency - prom-client. I don't see it in the dependencies of the your project. Have you checked, if it even works? Do you get the expected response from /metrics endpoint?

Pauss commented 3 years ago

I've let only this 4 packages for testing the virtual memory. (running a simple express app in docker container)

The library works well (along prom-client), no doubt about it. Maybe you can make the same test and see (with and without express-prom-bundle).

My concern was only about virtual memory it takes.

Pauss commented 3 years ago

hmm..after more testing, seems that when importing this lib with 'import' ("type": "module") and not with 'require' is causing this pb...