Re: [Nagios-devel] patch to speed up find_service, find_host, and xodtemplate_find_service

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] patch to speed up find_service, find_host, and xodtemplate_find_service

Post by Guest »

Cool! I will integrate this patch into CVS as soon as I branch the
1.x version off.

On 2 Oct 2002 at 13:36, Daniel Drown wrote:

> I have converted xodtemplate_service_list, service_list, and host_list to a
> chained hash from a linked list because I was seeing a scaling problem in
> 1.0b6 with 1800 hosts, each with 2 services.
>
> I saw anywhere from a 33% to 75% speedup with this patch. Detailed numbers
> and the patch are available at:
> http://dan.drown.org/nagios/
>
> The numbers for time /usr/local/bin/nagios /usr/local/etc/nagios/nagios.cfg
> are misleading because they include all cpu used by child processes. The
> gprof output shows that a significant difference in user cpu used (around 50%
> less). vmstat output was noticably different between the two runs, 10-20% cpu
> idle with the patch, 0-10% idle without.
>
> These tests were run on a 2xP3 930mhz, 1gb ram.
>
> The details of the patch:
> I removed the extra argument to find_host and find_service (this wasn't used
> anywhere in the code)
>
> I removed extern references to xodtemplate_service_list, service_list, and
> host_list outside of the .c files their helper functions were defined in.
>
> new functions:
> move_first_service() moves a static pointer to the head of
> service_list
> get_next_service() returns the current service and moves
> the static pointer to the next
>
> find_all_services_by_host(char *host) sets up get_next_service_by_host to
> return all services that host
> has
> get_next_service_by_host() returns host's next service
>
> move_first_host()
> get_next_host()
> - like move_first_service, and
> get_next_service
>
> get_host_cursor() returns an allocated cursor to iterate
> through host_list
> get_next_host_cursor(void *v_cursor) returns the next host using the cursor
> free_host_cursor(void *cursor) frees the cursor
>
> get_xodtemplate_service_cursor()
> get_next_xodtemplate_service(void *v_cursor)
> free_xodtemplate_service_cursor(void *cursor)
> - like get_host_cursor,
> get_next_host_cursor,
> and free_host_cursor
>
> get_next_N(..) helper function to do the work for
> get_next_*
>
>
> --
> It's looking like if MySQL AB doesn't make a movie based on the manual,
> nobody's ever gonna learn how to use a database.
> - r.
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/lis ... gios-devel
>



Ethan Galstad,
Nagios Developer
---
Email: nagios@nagios.org
Website: http://www.nagios.org






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: nagios@nagios.org
Locked