Performance issues, too1

Robert Hajime Lanning lanning at lanning.cc
Wed Jan 3 02:41:40 CET 2007


<quote who="Stanley.Hopcroft at Dest.gov.au">
> Context is massive memory leak with ePN. Leak goes when ePN is
> removed.

I have a feeling it is more with the way plugin caching works.

> There should be added another major caveat to this: depending on
> your plugins you may have a bigger or smaller leak, however leak
> it will.

I have gone through all my perl based plugins and changed "use vars"
to "my".  (Recommended from the embedded perl documentation.)

> For me, I wouldn't consider Nagios without ePN since I code most
> of my plugins in Perl and the advantages for me (and this
> installation) outweigh the leak.

Same here.  Especially loading the SNMP MIBs once in Nagios.

>
> Finally about the meaning of the configure switches for ePN.
>
> 1 --enable-embedded-perl
>
> This builds Perl into the Nagios executable and at the least
> means that your system does __not__ fork a new process to run
> Perl plugins. Instead, Perl is parsed and run by direct
> calls to the Nagios binary.
>
> So, setting this switch saves a context switch.

Also you remove the interpreter initialization load.

> 2 --with-perl-cache
>
> If in addition, this switch is set, the Perl plugin is compiled
> only once (otherwise, each time Nagios goes to run a Perl plugin,
> it recompiles it). The resultant Perl op code tree remains in
> memory.
>
> Unfortunately, for reasons that are not clear to me, this is the
> source of the leak.

The perl code path that runs in the master Nagios process (after
all pluggins have been compiled successfully and you remove argument
caching) is:

sub eval_file {
   my ($filename, $delete, undef, $plugin_args) = @_ ;
   my $mtime = -M $filename ;
   if ( exists($Cache{$filename}) && $Cache{$filename}[MTIME]
        && ($Cache{$filename}[MTIME] >= $mtime)) {
      if ( $Cache{$filename}[PLUGIN_ERROR] ) {
         ...
      } else {
         return $Cache{$filename}[PLUGIN_HNDLR];
      };
   };
};

I am not sure where the leak is, unless it is in the interpreter
itself.

With all the tuning my master process gains about 4MBytes a day.

-- 
And, did Galoka think the Ulus were too ugly to save?
                                         -Centauri


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list