novel idea for performance optimization

sean finney seanius at debian.org
Sun May 8 21:36:39 CEST 2005


hey folks,

(cross-posting to nagiosplug mailing list too)

i have this idea that's been floating around in my head for a while,
and wonder what other folks think.

one of the most notable performance hits on a nagios server is the huge
overhead from having to fork/exec a seperate binary for every check (and
many of these binaries go on to fork/exec or popen yet another system
call).  to the passing pessimist, this might be considered an unavoidable
hit because of how nagios works (with the plugins being a bunch of
seperate executable binaries).  however, i think i see a rather novel
way around the problem.

with a little ld linker voodoo, you could build a shared library version
of each plugin, where main() was renamed something identifiable to the
plugins.  

then in nagios, when it goes to execute a plugin, it first would check
to see if such a shared object existed.  if it doesn't, it executes the
binary just like it normally would, and if it does, it instead
dlopen()'s the library, and calls the function.  repeated calls to
the check would therefore have very little overhead, as not only would
the fork/exec be avoided, but the library would already be loaded and
resident in memory.

the one problems i see with this are that many of the plugins have less
than stellar memory management, and some might need some work to be
thread safe (and some of course are not executable binaries at all, but
instead perl/shell/whatever scripts).

so, what do you think?

	sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050508/2c5eb8bd/attachment.sig>


More information about the Developers mailing list