When pm2 is in cluster mode, does it use 1 core (cpu) per process?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
I am using pm2 really well for our project service. By the way, I have a question.
I am running a node api on k8s, but I want to use pm2, so I have a question while configuring k8s + pm2 + node api.
resources:
requests:
memory: 256Mi
cpu: 0.1
limits:
memory: 2Gi
cpu: 2
module.exports = {
apps: [
{
name:'api',
script:'dist/bundle.js',
instances: 6,
autorestart: true,
watch: false,
exec_mode:'cluster',
},
],
}
I did it as above, but looking at the log of the k8s pod, 6 pm2 processes were constantly restarting.
If you guess, starting with pm2 will allocate 1 cpu core per process? I wonder.
How could we reproduce this issue?
Supporting information
PM2 log: PM2 version : 4.5.0
PM2 log: Node.js version : 12.14.1
$ pm2 report
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Kubernetes resource manifest and the PM2 4.5.0 cluster configuration shown in the issue, then review the PM2 report and pod logs for the repeated restarts. Done means establishing whether cluster processes consume CPU independently and documenting the cause of the restarts or the configuration change required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, node.js
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100