- edited description
Feature request: start monitored processes in parallel
I'm trying to speed up time it takes to have all monitored processes up and running. At the moment, starting about 40 monitored processes via monit takes about a minute.
It seems that the monit is serial, it starts them 1 by 1; however since these processes are independent it would suit me more if they started in parallel. Secondly, starting a process via bash, takes 100 ms, however via monit it takes about 2 seconds?
If this is not planned or possible via monit, is there a workaround that you might suggest; perhaps pre-starting all processes via bash, and just having monit monitoring in PID and restart if needed?
Example of restart action
Process 'd-0' initializing
Process 'd-1' initializing
Process 'd-2' initializing
Process 'd-3' initializing
Process 'd-4' initializing
Process 'd-5' initializing
Process 'd-6' initializing
Process 'd-7' initializing
Process 'd-8' initializing
Process 'd-9' initializing
Process 'd-10' initializing
Process 'd-11' initializing
Process 'd-12' initializing
Process 'd-13' initializing
Process 'd-14' initializing
Process 'd-15' not monitored - restart pending
Process 'd-16' running - restart pending
Process 'd-17' running - restart pending
Process 'd-18' running - restart pending
Process 'd-19' running - restart pending
Process 'd-20' running - restart pending
Process 'd-31' running - restart pending
Process 'd-32' running - restart pending
Process 'd-33' running - restart pending
Process 'd-34' running - restart pending
Process 'd-35' running - restart pending
Process 'd-36' running - restart pending
Process 'd-37' running - restart pending
Process 'd-38' running - restart pending
Process 'd-39' running - restart pending
Process 'd-40' running - restart pending
Process 'd-41' running - restart pending
Process 'd-42' running - restart pending
Comments (10)
-
reporter -
repo owner -
assigned issue to
- changed version to 6.0
Your observation is correct. Monit, as it is, runs serialised and because it verify that a process started (or not) it can take a little more time at startup. However, parallel startup and parallel checks are planned. Work on this will start shortly in the Monit 6 branch.
-
assigned issue to
-
reporter Great, thnx for good and speedy response :)
-
repo owner One workaround could be to have systemd or sys.init be responsible for starting processes at system startup. And let Monit "take over" once the system is up and running.
-
repo owner - changed version to 6.0.0
-
repo owner - removed version
Removing version: 6.0.0 (automated comment)
-
Any word on this feature request? Even an alpha build would be really helpful for our organization.
-
Hello,
it seems to be nice to make the system startup faster, but sometimes it is necessary to serialize the application starting and stopping, or limit the number of concurrent starting and stopping application.I limit the applications starting concurrent all the time, because it is sometimes faster and more safe for large or complex applications.
A remark only,
Lutz -
hi all, I patched monit to do service checks in parallel. it’s very draft, but you may find it somewhat useful until a more sophisticated parallelism developing in the mainline. it’s based on version 5.20, but IMO it can be patched into newer versions as well with little extra effort.
The idea is: at
validate()
start eachs->check()
in a thread, but keep a global mutex locked for the vast amount of code, and release the lock only for sleep-like calls and for other calls which just wait (eg.Net_canRead()
), so other threads, the main thread and other service check threads can run in the meantime.I guess it remain thread-safe. These threads are not scheduled in any way by monit, just by the OS. At the current state it’s suitable for relatively short polling time, because service check results are not available immediately, they are only gathered on subsequent calls to
validate()
.patch: https://github.com/bAndie91/monit/commit/fac26b59ec603da64ee60ab3023035bf7e93fa5e
-
thanks Tildeslash for the deep insight. the plan looks promising.
-- Hrubák Bandi
Idézet:
- Log in to comment