Unitech / Unitech/pm2

When "PM2_CONCURRENT_ACTIONS=16 pm2 reload" is run, launch the new processes simultaneously, but kill the old processes in sequenece

Open
#5,197 0 comments 0 reactions 0 assignees View on GitHub

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?

When running e.g. PM2_CONCURRENT_ACTIONS=16 pm2 reload, pm2 spawns the new 16 cluster workers simultaneously and then kills the old 16 workers more or less simultaneously too, thus producing a thundering herd issue: all the clients (with long lived WS connections) got disconnected at the same time and then reconnected to the new workers at the same time too.

Would be cool to have the mode when the new workers are still spawned simultaneously (i.e. the new cluster is brought up), but then, the old workers are retired slowly, sequentially. In this case, the thundering herd would still land on the new workers (because they're ready at that time), but it would be spread in time.

How could we reproduce this issue?

PM2_CONCURRENT_ACTIONS=16 pm2 reload

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the reload path used by PM2_CONCURRENT_ACTIONS=16 pm2 reload, especially how new cluster workers are started and old workers are retired. Done means new workers still launch concurrently while old workers are stopped sequentially, avoiding simultaneous long-lived connection drops.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.