Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using pidtree package #20

Open
simonepri opened this issue Mar 20, 2018 · 5 comments
Open

Consider using pidtree package #20

simonepri opened this issue Mar 20, 2018 · 5 comments

Comments

@simonepri
Copy link

Currently this package recursively kill processes level by level spawning the ps or pgrep a lot of times.

I've built this package that maybe can help to improve performance.
https://github.com/simonepri/pidtree

My benchmarks shows that is really fast (~5-10 ms per call regardless of how big the sub-tree is) but I don't know if it would be adapt for the use of this package.

What's the advantage of calling ps or pgrep multiple times instead of parsing the tree just calling ps once? Memory efficiency? Or it was just simpler to implement?

See also:
Unitech/pm2#3554 (comment)

cc: @soyuka

@billiegoose
Copy link
Collaborator

billiegoose commented Mar 21, 2018

linux freebsd netbsd sunos macos win aix

✅ = Working ❓ = Not tested but should work

😲 That's amazing! I'm guessing @pkrumins wrote it that way because, that's just what he thought up at the time? I'd be interested in a PR that replaces the current logic with 'pidtree'. We would have to release it as a semver major version, though just in case. (When you have over 100,000 downloads a day and zero regression tests... it's good to be cautious.)

Edit: Hah I just saw that https://github.com/Unitech/pm2/pull/3554/files basically IS such a PR. Very interesting!

@simonepri
Copy link
Author

Hah I just saw that https://github.com/Unitech/pm2/pull/3554/files basically IS such a PR

Yes kind of.
Actually my belief is that taskkill should be faster for windows.

@jayarjo
Copy link

jayarjo commented Mar 8, 2019

Never merged?

@soyuka
Copy link

soyuka commented Mar 8, 2019

And IIRC he implemented taskkill and it's really performant.

@simonepri
Copy link
Author

I'll work on this as soon as possible, right now I'm a bit busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants