pm2 slow
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?
Sometimes pm2 is really slow. It takes, for example, 26 seconds to do pm2 status. Other operations are like list, logs, etc are also very slow. I've installed and uninstalled pm2 several times on my development computer.
How could we reproduce this issue?
I'm not able to reproduce this issue in a fresh installation (on a new virtual machine). But on my development computer, I get this often.
$ time pm2 status
┌─────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ idea │ default │ 3.0.0 │ fork │ 555371 │ 97s │ 0 │ online │ 0.1% │ 79.7mb │ jgr │ enabled │
│ 0 │ proxy │ default │ 1.0.0 │ fork │ 555364 │ 97s │ 0 │ online │ 0.1% │ 58.5mb │ jgr │ enabled │
└─────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
real 0m26,291s
user 0m0,256s
sys 0m0,035s
I would like to know what can I do on my side to know where the delay is. Is it network related? File system related? Am I able to enable more verbose output from pm2?
Both application used in this example starts immediately without pm2.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Tue May 31 2022 11:24:43 GMT+0100 (Western European Summer Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.0
node version : 12.13.1
node path : not found
argv : /home/jgr/.nvm/versions/node/v12.13.1/bin/node,/home/jgr/.nvm/versions/node/v12.13.1/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : jgr
uid : 1000
gid : 1000
uptime : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.0
node version : 12.13.1
node path : /home/jgr/.nvm/versions/node/v12.13.1/bin/pm2
argv : /home/jgr/.nvm/versions/node/v12.13.1/bin/node,/home/jgr/.nvm/versions/node/v12.13.1/bin/pm2,report
argv0 : node
user : jgr
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i7-10870H CPU @ 2.20GHz
cpus nb : 16
freemem : 1213796352
totalmem : 33472036864
home : /home/jgr
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ idea │ default │ 3.0.0 │ fork │ 557157 │ 60s │ 0 │ online │ 0.1% │ 82.0mb │ jgr │ enabled │
│ 0 │ proxy │ default │ 1.0.0 │ fork │ 557150 │ 60s │ 0 │ online │ 0.1% │ 58.6mb │ jgr │ enabled │
└─────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/jgr/.pm2/pm2.log last 20 lines:
PM2 | 2022-05-31T11:23:53: PM2 log: Time : Tue May 31 2022 11:23:53 GMT+0100 (Western European Summer Time)
PM2 | 2022-05-31T11:23:53: PM2 log: PM2 version : 5.2.0
PM2 | 2022-05-31T11:23:53: PM2 log: Node.js version : 12.13.1
PM2 | 2022-05-31T11:23:53: PM2 log: Current arch : x64
PM2 | 2022-05-31T11:23:53: PM2 log: PM2 home : /home/jgr/.pm2
PM2 | 2022-05-31T11:23:53: PM2 log: PM2 PID file : /home/jgr/.pm2/pm2.pid
PM2 | 2022-05-31T11:23:53: PM2 log: RPC socket file : /home/jgr/.pm2/rpc.sock
PM2 | 2022-05-31T11:23:53: PM2 log: BUS socket file : /home/jgr/.pm2/pub.sock
PM2 | 2022-05-31T11:23:53: PM2 log: Application log path : /home/jgr/.pm2/logs
PM2 | 2022-05-31T11:23:53: PM2 log: Worker Interval : 30000
PM2 | 2022-05-31T11:23:53: PM2 log: Process dump file : /home/jgr/.pm2/dump.pm2
PM2 | 2022-05-31T11:23:53: PM2 log: Concurrent actions : 2
PM2 | 2022-05-31T11:23:53: PM2 log: SIGTERM timeout : 1600
PM2 | 2022-05-31T11:23:53: PM2 log: ===============================================================================
PM2 | 2022-05-31T11:23:53: PM2 log: [Watch] Start watching proxy
PM2 | 2022-05-31T11:23:53: PM2 log: App [proxy:0] starting in -fork mode-
PM2 | 2022-05-31T11:23:53: PM2 log: [Watch] Start watching idea
PM2 | 2022-05-31T11:23:53: PM2 log: App [idea:1] starting in -fork mode-
PM2 | 2022-05-31T11:23:53: PM2 log: App [proxy:0] online
PM2 | 2022-05-31T11:23:53: PM2 log: App [idea:1] online
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
The report identifies pm2 status, list, and logs as slow but names no files or tests; start by profiling these CLI commands on the reported setup and comparing them with a fresh virtual machine. Done means identifying the source of the delay and documenting or fixing it with a reproducible test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100