Hi Monit Team,

while playing around with monit 5.1.1 and large amounts of services (~500) I 
noticed that monit was quite slow when starting these services because it would 
always sleep for a second after starting a service. Same goes for stopping.

The code path apparently changed a bit in 5.2.5 (or the timings were a bit 
different, causing the loop to succeed on first try) since the behavior wasn't 
directly noticeable, but the sleep is still there. I'd suggest to tone down the 
delay to something more useful like 5 ms (or even less), this ought to be more 
than enough time on current hardware for a process to get set up. I've attached 
a patch which does this.

Pulling in the complete process list to see if a service has been 
started/stopped can also be quite wasteful, especially with large process 
lists. Using the PID-files with sanity checks (process start time, etc.) should 
be enough for most cases and the full process list sweep can still be used as a 
fallthrough. But that's more of a todo item, it doesn't cause problems in our 
environment ;).

best,
Michael

Attachment: nanosleep.patch
Description: Binary data

_______________________________________________
monit-dev mailing list
monit-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/monit-dev

Reply via email to