Do not launch a shell for each check
Matthieu Kermagoret
mkermagoret at merethis.com
Mon May 31 16:28:53 CEST 2010
Hi list,
I'd like to propose a performance patch for Nagios that reduces the
number of Nagios' descendant processes.
The action of launching a single check involves multiple processes :
- child 1 (not executed if child_processes_fork_twice is disabled)
- launch child 2
- waits for child 2 termination
- child 2
- reset signal handling
- launch a shell (connected with a pipe via *popen*)
- read plugin output from the pipe
- write plugin output to a file
- shell
- executed as /sh -c command/
- variable expansion
- globbing
- every shell stuff you have on the command line
- launch the check itself
- check itself
- the obvious
In this event flow, we found that the shell execution wasn't required
in most cases. So, by avoiding /sh/ we could save fork/exec time and
reduce the number of concurrent processes at the same time. And indeed
shell's magic would still be available using /sh -c/ as the check
command with no performance penalty compared to the current situation.
What do you think about it ?
Best regards,
--
Matthieu KERMAGORET | Développeur
mkermagoret at merethis.com
MERETHIS est éditeur du logiciel Centreon.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios_no_popen.patch
Type: text/x-patch
Size: 5408 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20100531/79506b49/attachment.bin>
-------------- next part --------------
------------------------------------------------------------------------------
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list