A idea to speed up access times to service records

Andreas Ericsson ae at op5.se
Wed Mar 31 10:45:52 CEST 2004


Ian Holsman wrote:
> 
> Hi.
> 
> I was looking through the code while I was attempting to patch the glib 
> hash functions into the 1.x codebase, and was thinking that the services
> hash table wasn't ideal.
> 
> 
> wouldn't it be better if there was a linked list of services for each 
> host (instead of either a global linked list/hash on host/service name)
> 
> 
> ie.. in the host structure you would have something like
> 
> host_struct {
> ...
> service *service_head;
> ..
> }
> 
> and in the service_struct something like
> 
> service_struct {
> ..
> service *service_next;
> host*host
> }
> 
I'm currently working on creating proper configuration structs for 
nagios. If it doesn't get included in the main branch, I'll open up a 
new project and use it there.

> this was you could navigate around instead of having to go through all 
> the lists the matching host/service.
> I think the above would work better than having a hash on the combined 
> service/host names. and you could use this in a lot of places in the 
> nagios code.
> 
Indeed. Much isn't properly done in the code, but I'm guessing that is 
mostly for legacy reasons.

> oh.. a humble request..
> can someone please run indent on the code in CVS and check that in.
> 
I agree completely. However, since Ethan is the main developer, his 
coding standards are law in this project.
I suggest you get a nice .indent.pro (mine is attached) and run it 
recursively on the nagios code as such;
cd nagios
for i in `find -type d` ; do indent $i/*.c $i/*.h ; done

indent(1) for those who do not know is a GNU program and can be 
downloaded from http://www.gnu.org
It's most likely available as prepackaged binaries for your system.

> 
> Regards
> Ian.
> 
> -- 
> Ian Holsman
> blog: http://blog.holsman.net
> PH:  03-9857-3742 (oz)

-- 
Mvh / Best regards
Sourcerer / Andreas Ericsson
OP5 AB
+46 (0)733 709032
andreas.ericsson at op5.se


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click




More information about the Developers mailing list