Score:0

Seemly NodeJS restart | Docker vs PM2 vs Both?

cn flag

I have a NodeJS application that wraps a large obfuscated JavaScript file and utilizes it to run computations. The issue is the JavaScript file has a memory leak, and required fairly frequent restart to clear the memory. Currently I am using a systemd to kill and restart the process when it hits a specific memory usage, and while this works enough... its not ideal. I have been moving many other applications into docker because, awesome, and am wanting to try and tackle both tasks together but I am struggling to find a graceful way to accomplish this.

Ideally I would like to get the application to gracefully and seamlessly restart as soon as it crosses over a certain memory threshold and it becomes idle. I have been pouring over the docker website and can't find anything that specifically support this case. PM2 does allow for this but there seems to be a general sentiment across stack overflow (and a couple blogs) mixing them is 99.99% of the time a bad idea, but I wanted to try and do a sanity check to ensure I am not overthinking this.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.