]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_proxy_balancer.html.en
update transformation
[apache] / docs / manual / mod / mod_proxy_balancer.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_proxy_balancer - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.1</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_proxy_balancer</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
26 </div>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> extension for
28 load balancing </td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_balancer_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>proxy_balancer.c</td></tr>
32 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.1 and later</td></tr></table>
33 <h3>Summary</h3>
34
35     <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>. It provides load balancing support for
36     <code>HTTP</code>, <code>FTP</code> and <code>AJP13</code> protocols
37     </p>
38
39     <p>Thus, in order to get the ability of load balancing,
40     <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
41     have to be present in the server.</p>
42
43     <div class="warning"><h3>Warning</h3>
44       <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
45       servers are dangerous both to your network and to the Internet at
46       large.</p>
47     </div>
48 </div>
49 <div id="quickview"><h3 class="directives">Directives</h3>
50 <p>This module provides no
51             directives.</p>
52 <h3>Topics</h3>
53 <ul id="topics">
54 <li><img alt="" src="../images/down.gif" /> <a href="#scheduler">Load balancer scheduler algorithm</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#enable">Enabling Balancer Manager Support</a></li>
56 </ul><h3>See also</h3>
57 <ul class="seealso">
58 <li><code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></li>
59 </ul></div>
60 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
61 <div class="section">
62 <h2><a name="scheduler" id="scheduler">Load balancer scheduler algorithm</a></h2>
63     
64     <p>The idea behind this scheduler is the following:</p>
65
66     <p><dfn>lbfactor</dfn> is <em>how much we expect this worker
67     to work</em>, or <em>the workers's work quota</em>.</p>
68
69     <p><dfn>lbstatus</dfn> is <em>how urgent this worker has to work
70     to fulfill its quota of work</em>.</p>
71
72     <p>The <dfn>worker</dfn> is a member of the load balancer,
73     usually a remote host serving one of the supported protocols.</p>
74
75     <p>We distribute each worker's work quota to the worker, and then look
76     which of them needs to work most urgently (biggest lbstatus).  This
77     worker is then selected for work, and its lbstatus reduced by the
78     total work quota we distributed to all workers.  Thus the sum of all
79     lbstatus does not change.(*)</p>
80
81     <p>If some workers are disabled, the others will
82     still be scheduled correctly.</p>
83
84     <div class="example"><pre><code>for each worker in workers
85     worker lbstatus += worker lbfactor
86     total factor    += worker lbfactor
87     if worker lbstatus &gt; candidate lbstatus
88         candidate = worker
89
90 candidate lbstatus -= total factor</code></pre></div>
91
92     <p>If a balancer is configured as follows:</p>
93     
94     <table><tr><th>worker</th>
95         <th class="data">a</th>
96         <th class="data">b</th>
97         <th class="data">c</th>
98         <th class="data">d</th></tr>
99 <tr><th>lbfactor</th>
100         <td class="data">25</td>
101         <td class="data">25</td>
102         <td class="data">25</td>
103         <td class="data">25</td></tr>
104 <tr><th>lbstatus</th>
105         <td class="data">0</td>
106         <td class="data">0</td>
107         <td class="data">0</td>
108         <td class="data">0</td></tr>
109 </table>
110
111     <p>And <var>b</var> gets disabled, the following schedule is produced:</p>
112
113     <table><tr><th>worker</th>
114         <th class="data">a</th>
115         <th class="data">b</th>
116         <th class="data">c</th>
117         <th class="data">d</th></tr>
118 <tr><th>lbstatus</th>
119         <td class="data"><em>-50</em></td>
120         <td class="data">0</td>
121         <td class="data">25</td>
122         <td class="data">25</td></tr>
123 <tr><th>lbstatus</th>
124         <td class="data">-25</td>
125         <td class="data">0</td>
126         <td class="data"><em>-25</em></td>
127         <td class="data">50</td></tr>
128 <tr><th>lbstatus</th>
129         <td class="data">0</td>
130         <td class="data">0</td>
131         <td class="data">0</td>
132         <td class="data"><em>0</em></td></tr>
133 <tr><td class="data" colspan="5">(repeat)</td></tr>
134 </table>
135
136     <p>That is it schedules: <var>a</var> <var>c</var> <var>d</var>
137     <var>a</var> <var>c</var> <var>d</var> <var>a</var> <var>c</var>
138     <var>d</var> ...</p>
139
140     <p>The following asymmetric configuration works as one would expect:</p>
141
142     <table><tr><th>worker</th>
143         <th class="data">a</th>
144         <th class="data">b</th></tr>
145 <tr><th>lbfactor</th>
146         <td class="data">70</td>
147         <td class="data">30</td></tr>
148 <tr><td class="data" colspan="2">&nbsp;</td></tr>
149 <tr><th>lbstatus</th>
150         <td class="data"><em>-30</em></td>
151         <td class="data">30</td></tr>
152 <tr><th>lbstatus</th>
153         <td class="data">40</td>
154         <td class="data"><em>-40</em></td></tr>
155 <tr><th>lbstatus</th>
156         <td class="data"><em>10</em></td>
157         <td class="data">-10</td></tr>
158 <tr><th>lbstatus</th>
159         <td class="data"><em>-20</em></td>
160         <td class="data">20</td></tr>
161 <tr><th>lbstatus</th>
162         <td class="data"><em>-50</em></td>
163         <td class="data">50</td></tr>
164 <tr><th>lbstatus</th>
165         <td class="data">20</td>
166         <td class="data"><em>-20</em></td></tr>
167 <tr><th>lbstatus</th>
168         <td class="data"><em>-10</em></td>
169         <td class="data">10</td></tr>
170 <tr><th>lbstatus</th>
171         <td class="data"><em>-40</em></td>
172         <td class="data">40</td></tr>
173 <tr><th>lbstatus</th>
174         <td class="data">30</td>
175         <td class="data"><em>-30</em></td></tr>
176 <tr><th>lbstatus</th>
177         <td class="data"><em>0</em></td>
178         <td class="data">0</td></tr>
179 <tr><td class="data" colspan="3">(repeat)</td></tr>
180 </table>
181
182     <p>That is after 10 schedules, the schedule repeats and 7 <var>a</var>
183     are selected with 3 <var>b</var> interspersed.</p>
184 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
185 <div class="section">
186 <h2><a name="enable" id="enable">Enabling Balancer Manager Support</a></h2>
187     
188     <p>This module <em>requires</em> the service of 
189     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>.
190     Balancer manager enables dynamic update of balancer
191     members. You can use balancer manager to change the balance
192     factor or a particular member, or put it in the off line
193     mode.
194     </p>
195
196     <p>Thus, in order to get the ability of load balancer management,
197     <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> and <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
198     have to be present in the server.</p>
199
200     <p>To enable load balancer management for browsers from the foo.com
201     domain add this code to your <code>httpd.conf</code>
202     configuration file</p>
203 <div class="example"><p><code>
204     &lt;Location /balancer-manager&gt;<br />
205     SetHandler balancer-manager<br />
206 <br />
207     Order Deny,Allow<br />
208     Deny from all<br />
209     Allow from .foo.com<br />
210     &lt;/Location&gt;
211 </code></p></div>
212
213     <p>You can now access load balancer manager by using a Web browser
214     to access the page
215     <code>http://your.server.name/balancer-manager</code></p>
216 </div>
217 </div>
218 <div class="bottomlang">
219 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy_balancer.html" title="English">&nbsp;en&nbsp;</a> |
220 <a href="../ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
221 </div><div id="footer">
222 <p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
223 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
224 </body></html>