Nagios 1.2 fast IO-patch

Andreas Ericsson ae at op5.se
Mon Mar 22 17:07:58 CET 2004


Hi all.

I wrote this patch the other day when I was juggling with automating 
reports (avail.cgi), and I noticed that parsing the files alone took 8 
seconds, even though it was less than 3MB of data.
The solution was to rewrite the read_line() function in cgiutils.c to 
utilize larger read()-buffers and thus allow for IO bursting.
With this patch applied execution time went down to 0.7 seconds.

It also solves the problem with not-newline-terminated rows not being 
read in the configuration files (discussed earlier).

The only drawback is that it will take forever to parse files that are 
larger than you have physical RAM available (the kernel will utilize the 
swap-space), and will fail completely (pretending the file is empty) if 
the file is larger than the physical AND virtual RAM combined. However, 
considering that it already takes forever even with relatively small 
files, this shouldn't be a problem.

This patch is also available for 2.0a1, but I haven't had time to test 
it to any extent with that release.

Tested on Openwall GNU/*/Linux, kernel 2.4.24-ow1 running on;
a) Celeron 2.0Ghz with 256MB RAM and a single 40GB IDE-disk.
b) Pentium 4 HT 2.8Ghz with 512MB RAM and dual 120GB IDE-disks with 
software RAID-mirroring.
c) Dell Inspiron PIII 866Mhz with 256MB RAM and a single 20GB IDE-disk.

Cheers,
Sourcerer / Andreas Ericsson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nagios-1.2_fast-IO.diff
Type: text/x-patch
Size: 20233 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20040322/e65f28f5/attachment.bin>


More information about the Developers mailing list