soyuka / pidusage

Cross-platform process cpu % and memory usage of a PID
MIT License
512 stars 55 forks source link

Useful to indicate when to scale? #20

Closed roccomuso closed 8 years ago

roccomuso commented 8 years ago

Hi guys,

Someone using this in production?

For istance, how do you know based on the process usage when it's time to scale up an application?

Thanks.

soyuka commented 8 years ago

I use it mostly for benchmarks or monitoring.

You could easily keep process usage statistics and then compute to see if you need to scale.

roccomuso commented 8 years ago

@soyuka you're right.

I'm trying pidusage under windows. The used memory is around 40MB per process. The cpu_usage always shows me 0. Is it reliable?

soyuka commented 8 years ago

There has been many discussions around windows, I'm looking for better ways.

For now it spawns wmic (https://github.com/soyuka/pidusage/blob/master/lib/stats.js#L135), and I find it slow and dirty. So, yes according to wmic spec, it should be reliable. If it's efficient, I won't vouch for it on windows.

If you have any idea on how I could improve the windows part please let me know! What's hard is to keep it portable (see #10 #9 #7)

roccomuso commented 8 years ago

I see.

Well, at least on my Linux servers there shouldn't be issues. :+1:

soyuka commented 8 years ago

No worries on linux, except if you want to compute child processes ;).