Replies: 3 comments 1 reply
|
Moving this to discussion as it's for gathering feedback |
|
This answer is a bit late, but we recently switched from musl malloc to jemalloc. We suspected memory fragmentation as the reason for node.js garbage collection failing to a OOM kill. After switching we have not seen such OOM kills yet. |
|
Yes, people use jemalloc with Node.js in production, but it is not bundled or officially recommended by Node.js. It's an optional, workload-dependent tweak. When it can help
How to try it (Linux, no code changes) # Debian/Ubuntu
apt-get install -y libjemalloc2
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 node app.jsIn a Dockerfile: RUN apt-get update && apt-get install -y libjemalloc2
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2(The library path differs by distro and architecture, e.g. Cheaper things to try first
Caveats
Hope this helps. If you share your use case (memory growth pattern, OS, container setup), people can give more specific advice. |
Uh oh!
There was an error while loading. Please reload this page.
What is the problem this feature will solve?
I saw some issues earlier about using jemalloc, has anyone done this in a production environment ? thanks !
What is the feature you are proposing to solve the problem?
none
What alternatives have you considered?
No response
All reactions