1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Fast Startup Options</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<meta name="keywords" content="Supervision, Icinga, Nagios, Linux">
<link rel="home" href="index.html" title="Icinga Version 1.0.2 Documentation">
<link rel="up" href="ch07.html" title="Chapter 7. Security and Performance Tuning">
<link rel="prev" href="tuning.html" title="Tuning Icinga For Maximum Performance">
<link rel="next" href="largeinstalltweaks.html" title="Large Installation Tweaks">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<CENTER><IMG src="../images/logofullsize.png" border="0" alt="Icinga" title="Icinga"></CENTER>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Fast Startup Options</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="tuning.html">Prev</a> </td>
<th width="60%" align="center">Chapter 7. Security and Performance Tuning</th>
<td width="20%" align="right"> <a accesskey="n" href="largeinstalltweaks.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section" title="Fast Startup Options">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="faststartup"></a><a name="fast_startup"></a>Fast Startup Options</h2></div></div></div>
<p><span class="bold"><strong>Introduction</strong></span></p>
<p>There are a few things you can do that can decrease the amount of time it take Icinga to startup (or restart). These speedups
involve easing some of the burden involved in processing your configuration files.</p>
<p>Using these techniques is particularly useful when you have one or more of the following:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>Large configurations</p>
</li>
<li class="listitem">
<p>Complex configurations (heavy use of template features)</p>
</li>
<li class="listitem">
<p>Installations where frequest restarts are necessary</p>
</li>
</ul></div>
<p><span class="bold"><strong>Background</strong></span></p>
<p>Whenever Icinga starts/restarts it has to process your configuration files before it can get down to the business of
monitoring. This configuration startup process involves a number of steps:</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>Reading the config files</p>
</li>
<li class="listitem">
<p>Resolving template definitions</p>
</li>
<li class="listitem">
<p>"Recombobulating" your objects (Ethan Galstads term for the various types of work that occurs)</p>
</li>
<li class="listitem">
<p>Duplicating object definitions</p>
</li>
<li class="listitem">
<p>Inheriting object properties</p>
</li>
<li class="listitem">
<p>Sorting your object definitions</p>
</li>
<li class="listitem">
<p>Verifying object relationship integrity</p>
</li>
<li class="listitem">
<p>Checking for circular paths</p>
</li>
<li class="listitem">
<p>and more...</p>
</li>
</ul></div>
<p>Some of these steps can be quite time-consuming when you have large or complex configurations. Is there a way to speed any of these
steps up? Yes!</p>
<p><span class="bold"><strong>Evaluating Startup Times</strong></span></p>
<p>Before we get on to making things faster, we need to see what's possible and whether or not we should even bother with the whole
thing. This is easy to do - simply start Icinga with the <span class="bold"><strong>-s</strong></span> or <span class="bold"><strong>
--test-scheduling</strong></span> command line switch to get timing and scheduling information.</p>
<p>Starting with Icinga 1.0.2 there is an additional option <span class="bold"><strong>-S</strong></span> or <span class="bold"><strong>
--show-scheduling</strong></span>. This will add information about the scheduling queue to the output.</p>
<p>An example of the output (abbreviated to only show relevant portions) is shown below. For this example, we're using an Icinga
config that has 25 hosts defined and just over 10,000 services.</p>
<pre class="screen"> #> /usr/local/icinga/bin/icinga -s /usr/local/icinga/etc/icinga.cfg
Icinga 1.0.2
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-16-2009
License: GPL
Timing information on object configuration processing is listed
below. You can use this information to see if precaching your
object configuration would be useful.
Object Config Source: Config files (uncached)
OBJECT CONFIG PROCESSING TIMES (* = Potential for precache savings with -u option)
----------------------------------
Read: 0.486780 sec
Resolve: 0.004106 sec *
Recomb Contactgroups: 0.000077 sec *
Recomb Hostgroups: 0.000172 sec *
Dup Services: 0.028801 sec *
Recomb Servicegroups: 0.010358 sec *
Duplicate: 5.666932 sec *
Inherit: 0.003770 sec *
Recomb Contacts: 0.030085 sec *
Sort: 2.648863 sec *
Register: 2.654628 sec
Free: 0.021347 sec
============
TOTAL: 11.555925 sec * = 8.393170 sec (72.63%) estimated savings
Timing information on configuration verification is listed below.
CONFIG VERIFICATION TIMES (* = Potential for speedup with -x option)
----------------------------------
Object Relationships: 1.400807 sec
Circular Paths: 54.676622 sec *
Misc: 0.006924 sec
============
TOTAL: 56.084353 sec * = 54.676622 sec (97.5%) estimated savings</pre>
<p>Okay, let's see what happened. Looking at the totals, it took roughly <span class="bold"><strong>11.6</strong></span> seconds to process the
configuration files and another <span class="bold"><strong>56</strong></span> seconds to verify the config. That means that every time we start or
restart Icinga with this configuration, it will take nearly <span class="bold"><strong>68 seconds</strong></span> of startup work before it
can monitor anything! That's not acceptable if we have to restart Icinga on a semi-regular basis.</p>
<p>What can we do about this? Take another look at the output and you'll see that Icinga estimates that we could save about
<span class="bold"><strong>8.4</strong></span> seconds off the configuration processing time and another <span class="bold"><strong>54.7</strong></span> off
the verification times. In total, Icinga thinks we could save <span class="bold"><strong>63 seconds</strong></span> of the normal startup
time if some optimizations were taken.</p>
<p>Whoa! From <span class="bold"><strong>68 seconds</strong></span> to just <span class="bold"><strong>5 seconds</strong></span>? Yep, read on for how to
do it.</p>
<p><span class="bold"><strong>Pre-Caching Object Configuration</strong></span></p>
<p>Icinga can spend quite a bit of time parsing your config files, especially if you make use of the template features such as
inheritance, etc. In order to reduce the time it takes to parse your config, you can have Icinga pre-process and pre-cache your
config files for future use.</p>
<div class="informaltable">
<table border="0">
<colgroup>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td align="left" valign="top">
<p> When you run Icinga with the <span class="bold"><strong>-p</strong></span> command line
option, Icinga will read your config files in, process them, and save them to a pre-cached object config file (specified by
the <a class="link" href="configmain.html#configmain-precached_object_file">precached_object_file</a> directive). This pre-cached config file will
contain pre-processed configuration entries that are easier/faster for Icinga to process in the future.</p> <p>You
must use the <span class="bold"><strong>-p</strong></span> command line option along with either the <span class="bold"><strong>-v</strong></span> or
<span class="bold"><strong>-s</strong></span> command line options, as shown below. This ensures that your configuration is verified before
the precached file is created.</p> <pre class="screen"> /usr/local/icinga/bin/icinga -pv /usr/local/icinga/etc/icinga.cfg </pre> <p>The size of your precached
config file will most likely be significantly larger than the sum of the sizes of your object config files. This is normal and by
design.</p>
</td>
<td align="left" valign="top"><p> <span class="inlinemediaobject"><img src="../images/fast-startup1.png"></span> </p></td>
</tr>
<tr>
<td align="left" valign="top">
<p> Once the precached object configuration file have been created, you can start
Icinga and tell it to use the precached config file instead of your object config file(s) by using the <span class="bold"><strong>-u</strong></span> command line option.</p> <pre class="screen"> /usr/local/icinga/bin/icinga -ud /usr/local/icinga/etc/icinga.cfg </pre>
<p><span class="inlinemediaobject"><img src="../images/important.gif"></span> If you modify your configuration files, you will need to re-verify and re-cache your configuration files
before restarting Icinga. If you don't re-generate the precached object file, Icinga will continue to use your old
configuration because it is now reading from the precached file, rather than your source configuration files.</p>
</td>
<td align="left" valign="top"><p> <span class="inlinemediaobject"><img src="../images/fast-startup2.png"></span> </p></td>
</tr>
</tbody>
</table>
</div>
<p><span class="bold"><strong>Skipping Circular Path Tests</strong></span></p>
<p>The second (and most time-intensive) portion of the configuration startup phase is the circular path check. In the example above, it
took nearly a minute to perform this step of the configuration verification.</p>
<p>What is the circular path check and why does it take so long? The circular patch check is designed to ensure that you don't define
any circular paths in your host, host dependency, or service dependency definitions. If a circular path existed in your config files,
Icinga could end up in a deadlock situation. The most likely reason for the check taking so long is that we're not using an
efficient algorithm. A much more efficient algorithm for detecting circular paths would be most welcomed. Hint: That means all you CompSci
graduate students who have been emailing me about doing your thesis on Icinga can contribute some code back. :-)</p>
<p>If you want to skip the circular path check when Icinga starts, you can add the -x command line option like this:</p>
<pre class="screen"> /usr/local/icinga/bin/icinga -xd /usr/local/icinga/etc/icinga.cfg </pre>
<p><span class="inlinemediaobject"><img src="../images/important.gif"></span> It is of utmost importance that you verify your configuration before starting/restarting Icinga when
skipping circular path checks. Failure to do so could lead to deadlocks in the Icinga logic. You have been warned.</p>
<p><span class="bold"><strong>Putting It All Together</strong></span></p>
<p>Follow these steps if you want to make use of potential speedups from pre-caching your configuration and skipping circular path
checks.</p>
<p>1. Verify your configuration and create the precache file with the following command:</p>
<pre class="screen"> /usr/local/icinga/bin/icinga -vp /usr/local/icinga/etc/icinga.cfg </pre>
<p>2. Stop Icinga if it is currently running.</p>
<p>3. Start Icinga like so to use the precached config file and skip circular path checks:</p>
<pre class="screen"> /usr/local/icinga/bin/icinga -uxd /usr/local/icinga/etc/icinga.cfg </pre>
<p>4. When you modify your original configuration files in the future and need to restart Icinga to make those changes take
place, repeat step 1 to re-verify your config and regenerate your cached config file. Once that is done you can restart Icinga
through the web interface or by sending a SIGHUP signal. If you don't re-generate the precached object file, Icinga will continue
to use your old confguration because it is now reading from the precached file, rather than your source configuration files.</p>
<p>5. That's it! Enjoy the increased startup speed.</p>
<a class="indexterm" name="id2005973"></a>
<a class="indexterm" name="id2005985"></a>
<a class="indexterm" name="id2005976"></a>
<a class="indexterm" name="id2006010"></a>
<a class="indexterm" name="id2005999"></a>
<a class="indexterm" name="id2006012"></a>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="tuning.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="largeinstalltweaks.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Tuning Icinga For Maximum Performance </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Large Installation Tweaks</td>
</tr>
</table>
</div>
<P class="copyright">© 2009-2010 Icinga Development Team, http://www.icinga.org</P>
</body>
</html>
|