monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exec action performance


From: Jan-Henrik Haukeland
Subject: Re: exec action performance
Date: Thu, 17 Mar 2016 23:59:39 +0100

A standard exec action is performed with spawn() which you can investigate 
here, 
https://bitbucket.org/tildeslash/monit/src/80ce931b4f4e4dc0324d0bd290cd7fc50c741c87/src/spawn.c?at=master&fileviewer=file-view-default

This is basically a standard fork->exec (with a twist) which you can also see 
in posix_spawn etc. Three things to note, 1) a fork->exec is “expensive” in 
computing terms, but this is also what your OS or shell does when it starts a 
new program. I.e. it is a standard operation. 2) Seeing a CPU spike at program 
startup, especially when done 20 times in a short timeframe is to be expected. 
If the CPU usage goes back to normal fairly quick it is nothing to worry about. 
3)  In Monit, “if X then exec ..” is  meant to be used in out of bounds 
situations and if you have 20 execs you should probably tune ‘X’ above. 

Ps. "check program”, start and restart executes in a slightly different way


> On 17 Mar 2016, at 22:58, Bill Durant <address@hidden> wrote:
> 
> Hello:
> 
> How does Monit perform the exec action internally?
> 
> I am finding that running too many "exec" actions during a polling
> interval causes a high system CPU usage spike.
> 
> I am able to duplicate the CPU spike by having Monit run 20 exec actions
> at every 30 second polling interval even it runs a program that does
> nothing such as the following:
> 
> $ cat foo.c
> main(){}
> 
> $ cc -c foo foo.c
> 
> So when Monit runs "foo" 20 times via the exec action, at every polling
> interval, the system CPU usage jumps to 90%+.
> 
> And staggering the exec's with a 'run every N cycles' or 'run every cron
> xxx' appears to not guarantee that the number of exec's run on every
> polling cycle will be minimized.
> 
> Is the exec action heavy weight by design?
> 
> Thanks,
> 
> Bill
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]