Web interface a bit slow

Mooney, Ryan ryan.mooney at pnl.gov
Fri Jun 13 02:28:17 CEST 2003


Stanley,

Thanks for the response.

I actually had already looked at the code in CVS and it doesn't fix this specific 
problem.  The "inserts" into the data structure from the status data file/database are 
still done by traversing a linked list, only the (later) lookups are faster.  
Actually even thats not really true, as it looks like the specific area I'm looking
at doesn't have the hash lookup wrappers, only the object file parts have that, not 
the status file parts.

My problem is that I have so many services that looking up where to insert a 
status record takes to long (> 8 seconds total for all the services according to
gprof).  The hash stuff would speed up some other parts, but this part would still
be really slow and its whats eating most of my time (as noted below).

In specific the lines that read:

   for(temp_svcstatus=servicestatus_list;temp_svcstatus!=NULL;temp_svcstatus=temp_svcstatus->next){
		if(strcmp(new_svcstatus->host_name,temp_svcstatus->host_name)<0){
   <snip>
   }

is where all the time is spent.  This is actually because I have a semi pathological
case where the data order in the file seems to require a full traversal of the list 
to put each service status record in its position almost every time.  I tried changing 
the host sort order there (strcmp >0) which helped there, but moved the problem to the 
lookup (this COULD be solved by implementing the hash wrappers for this code section).  
However that is a bad general solution since I happen to be bad one way doesn't mean 
someone else isn't ordered the other way (??).  

As far as I can tell the only general case solution is to kill the linked list for
the service status structure and use something else.

> -----Original Message-----
> From: Stanley Hopcroft [mailto:Stanley.Hopcroft at IPAustralia.Gov.AU]
> Sent: Thursday, June 12, 2003 5:12 PM
> To: Mooney, Ryan
> Cc: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] Web interface a bit slow
> 
> 
> Dear Sir,
> 
> The linked list search performance hit has been canvassed before
> 
> Someone has cntributed code for it and it will be released 
> IIRC in 2.0 
> (see forthcoming on the Nag page).
> 
> You may want to have a look in the CVS and see if there is something 
> usable there.
> 
> If you want to go from scratch - ypu don't like the CVS - a RAD 
> __possibility__ may be
> 
> 1 embed Perl
> 2 use the Perl hash API
> 
> Yours sincerely.
> -- 
> --------------------------------------------------------------
> ----------
> Stanley Hopcroft
> --------------------------------------------------------------
> ----------
> 
> '...No man is an island, entire of itself; every man is a piece of the
> continent, a part of the main. If a clod be washed away by the sea,
> Europe is the less, as well as if a promontory were, as well as if a
> manor of thy friend's or of thine own were. Any man's death diminishes
> me, because I am involved in mankind; and therefore never send to know
> for whom the bell tolls; it tolls for thee...'
> 
> from Meditation 17, J Donne.
> 


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
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