Unitech / Unitech/pm2

performance improvement proposal for God.getMonitorData hot path

Open
#6,085 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

Hi team :) id like to propose a small performance improvement in God.getMonitorData inside lib/God/ActionMethods.js. This path runs very frequently and currently does extra per-cycle work, so the goal is to keep behavior exactly the same while reducing internal overhead. The idea is to do a single pass to initialize default monit values and collect only valid online targets with valid pids, then apply pidusage stats in a separate linear pass directly on those targets. There are no API or contract changes, fallback behavior stays the same when pidusage fails or returns invalid data, and output semantics are unchanged. I validated the approach with local A/B benchmarks and targeted tests, and it shows measurable gains especially under higher process counts. If you agree with this direction, I can open a PR with the full diff and benchmark/test evidence.

Happy hacking.

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 in lib/God/ActionMethods.js at God.getMonitorData and review the current per-cycle work and fallback behavior. Use the targeted tests and local A/B benchmarks mentioned in the issue to validate the change. Done means unchanged output and fallback semantics with measurable gains, particularly at higher process counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
observability, performance, tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.