Patch - Nagios 3.2 - remove sleep on run_event == FALSE in main loop (events.c) if use_large_installation_tweaks == 1

Max perldork at webwizarddesign.com
Sun Mar 14 18:22:23 CET 2010


Hi,

5 months back I submitted a simple patch that removed the sleep code
from the main loop of Nagios for non-runnable events:

http://markmail.org/message/sdjpfmmcpvowp2rx#query:+page:1+mid:puldtebavtol3cet+state:results

This is a re-release of that patch wrapped in conditional code that
will cause Nagios to only skip the sleep if
use_large_installation_tweaks is set to 1.

We continue to use it and it makes a notable performance difference
for larger configurations running on a Nagios poller.

- Max

--- base/events.c.orig	2010-03-14 13:10:27.000000000 -0400
+++ base/events.c	2010-03-14 13:14:29.000000000 -0400
@@ -85,6 +85,8 @@

 extern int      time_change_threshold;

+extern int      use_large_installation_tweaks;
+
 timed_event *event_list_low=NULL;
 timed_event *event_list_low_tail=NULL;
 timed_event *event_list_high=NULL;
@@ -1143,19 +1145,22 @@
 			/* wait a while so we don't hog the CPU... */
 			else{

-				log_debug_info(DEBUGL_EVENTS,2,"Did not execute scheduled event.
Idling for a bit...\n");
+				/* Skipping this additional sleep time helps performance for
large installations by noticeably reducing latency */
+				if(use_large_installation_tweaks==FALSE){
+					log_debug_info(DEBUGL_EVENTS,2,"Did not execute scheduled event.
 Idling for a bit...\n");

 #ifdef USE_NANOSLEEP
-				delay.tv_sec=(time_t)sleep_time;
-				delay.tv_nsec=(long)((sleep_time-(double)delay.tv_sec)*1000000000);
-				nanosleep(&delay,NULL);
+					delay.tv_sec=(time_t)sleep_time;
+					delay.tv_nsec=(long)((sleep_time-(double)delay.tv_sec)*1000000000);
+					nanosleep(&delay,NULL);
 #else
-				delay.tv_sec=(time_t)sleep_time;
-				if(delay.tv_sec==0L)
-					delay.tv_sec=1;
-				delay.tv_nsec=0L;
-				sleep((unsigned int)delay.tv_sec);
+					delay.tv_sec=(time_t)sleep_time;
+					if(delay.tv_sec==0L)
+						delay.tv_sec=1;
+					delay.tv_nsec=0L;
+					sleep((unsigned int)delay.tv_sec);
 #endif
+					}
 			        }
 		        }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: events.c.patch
Type: application/octet-stream
Size: 1444 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20100314/6d9a800a/attachment.obj>
-------------- next part --------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list