mod_proxy_balancer.html.en revision 4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<?xml version="1.0" encoding="ISO-8859-1"?>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess This file is generated from xml source: DO NOT EDIT
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5a58787efeb02a1c3f06569d019ad81fd2efa06end -->
5a58787efeb02a1c3f06569d019ad81fd2efa06end<title>mod_proxy_balancer - Apache HTTP Server</title>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<body>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div id="page-header">
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz<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>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="apache">Apache HTTP Server Version 2.3</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<img alt="" src="/images/feather.gif" /></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
4b5981e276e93df97c34e4da05ca5cf8bbd937dand<div id="path">
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<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/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<div id="page-content">
d05d0eb4ae6d2a5e513fc3bf2555ce33da416634nd<div id="preamble"><h1>Apache Module mod_proxy_balancer</h1>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<div class="toplang">
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_balancer.html" title="English">&nbsp;en&nbsp;</a> |
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<a href="/ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<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 load balancing </td></tr>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>proxy_balancer_module</td></tr>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>proxy_balancer.c</td></tr>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.1 and later</td></tr></table>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h3>Summary</h3>
5ae30adbe59946de742ab0cd6be3b7457471a698takashi
5a58787efeb02a1c3f06569d019ad81fd2efa06end <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
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <code>HTTP</code>, <code>FTP</code> and <code>AJP13</code> protocols
5a58787efeb02a1c3f06569d019ad81fd2efa06end </p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>Thus, in order to get the ability of load balancing,
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <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>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf have to be present in the server.</p>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <div class="warning"><h3>Warning</h3>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf servers are dangerous both to your network and to the Internet at
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf large.</p>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf </div>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf</div>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<div id="quickview"><h3 class="directives">Directives</h3>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<p>This module provides no
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf directives.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h3>Topics</h3>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<ul id="topics">
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<li><img alt="" src="/images/down.gif" /> <a href="#scheduler">Load balancer scheduler algorithm</a></li>
60a4b2c422dcbb08a554fb193105c08da592718bpoirier<li><img alt="" src="/images/down.gif" /> <a href="#requests">Request Counting Algorithm</a></li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<li><img alt="" src="/images/down.gif" /> <a href="#traffic">Weighted Traffic Counting Algorithm</a></li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<li><img alt="" src="/images/down.gif" /> <a href="#environment">Exported Environment Variables</a></li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<li><img alt="" src="/images/down.gif" /> <a href="#enable">Enabling Balancer Manager Support</a></li>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess</ul><h3>See also</h3>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<ul class="seealso">
60a4b2c422dcbb08a554fb193105c08da592718bpoirier<li><code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></li>
60a4b2c422dcbb08a554fb193105c08da592718bpoirier</ul></div>
60a4b2c422dcbb08a554fb193105c08da592718bpoirier<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<div class="section">
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<h2><a name="scheduler" id="scheduler">Load balancer scheduler algorithm</a></h2>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
5a58787efeb02a1c3f06569d019ad81fd2efa06end <p>At present, there are 2 load balancer scheduler algorithms available
5a58787efeb02a1c3f06569d019ad81fd2efa06end for use: Request Counting and Weighted Traffic Counting. These are controlled
5a58787efeb02a1c3f06569d019ad81fd2efa06end via the <code>lbmethod</code> value of the Balancer definition. See
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess the <code class="directive"><a href="/mod/mod_proxy.html#proxy">Proxy</a></code> directive for
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess more information.</p>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
9bcfc3697a91b5215893a7d0206865b13fc72148nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<div class="section">
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<h2><a name="requests" id="requests">Request Counting Algorithm</a></h2>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>Enabled via <code>lbmethod=byrequests</code>, the idea behind this
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess scheduler is that we distribute the requests among the
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess various workers to ensure that each gets their configured share
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess of the number of requests. It works as follows:</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p><dfn>lbfactor</dfn> is <em>how much we expect this worker
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess to work</em>, or <em>the workers's work quota</em>. This is
cd9f05dfac570b44f26f531e01869e679c45401berikabele a normalized value representing their "share" of the amount of
cd9f05dfac570b44f26f531e01869e679c45401berikabele work to be done.</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p><dfn>lbstatus</dfn> is <em>how urgent this worker has to work
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess to fulfill its quota of work</em>.</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
9bcfc3697a91b5215893a7d0206865b13fc72148nd <p>The <dfn>worker</dfn> is a member of the load balancer,
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess usually a remote host serving one of the supported protocols.</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>We distribute each worker's work quota to the worker, and then look
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess which of them needs to work most urgently (biggest lbstatus). This
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess worker is then selected for work, and its lbstatus reduced by the
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess total work quota we distributed to all workers. Thus the sum of all
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess lbstatus does not change(*) and we distribute the requests
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess as desired.</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>If some workers are disabled, the others will
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess still be scheduled correctly.</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <div class="example"><pre><code>for each worker in workers
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess worker lbstatus += worker lbfactor
5a58787efeb02a1c3f06569d019ad81fd2efa06end total factor += worker lbfactor
5a58787efeb02a1c3f06569d019ad81fd2efa06end if worker lbstatus &gt; candidate lbstatus
5a58787efeb02a1c3f06569d019ad81fd2efa06end candidate = worker
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
9bcfc3697a91b5215893a7d0206865b13fc72148ndcandidate lbstatus -= total factor</code></pre></div>
9bcfc3697a91b5215893a7d0206865b13fc72148nd
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>If a balancer is configured as follows:</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <table><tr><th>worker</th>
49038652341bbe660a629c860507622583f8fdf0kess <th class="data">a</th>
d565edaec710102f7e7d06252aaf1de67b7ddd25rbowen <th class="data">b</th>
49038652341bbe660a629c860507622583f8fdf0kess <th class="data">c</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">d</th></tr>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<tr><th>lbfactor</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">25</td>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">25</td>
5a58787efeb02a1c3f06569d019ad81fd2efa06end <td class="data">25</td>
5a58787efeb02a1c3f06569d019ad81fd2efa06end <td class="data">25</td></tr>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<tr><th>lbstatus</th>
5ae30adbe59946de742ab0cd6be3b7457471a698takashi <td class="data">0</td>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">0</td>
9bcfc3697a91b5215893a7d0206865b13fc72148nd <td class="data">0</td>
9bcfc3697a91b5215893a7d0206865b13fc72148nd <td class="data">0</td></tr>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess</table>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>And <var>b</var> gets disabled, the following schedule is produced:</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <table><tr><th>worker</th>
49038652341bbe660a629c860507622583f8fdf0kess <th class="data">a</th>
fc0e302cc26d443c3441238f00e7b5a201b3bbb9rbowen <th class="data">b</th>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <th class="data">c</th>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <th class="data">d</th></tr>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick<tr><th>lbstatus</th>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data"><em>-50</em></td>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data">0</td>
49038652341bbe660a629c860507622583f8fdf0kess <td class="data">25</td>
5ae30adbe59946de742ab0cd6be3b7457471a698takashi <td class="data">25</td></tr>
fc0e302cc26d443c3441238f00e7b5a201b3bbb9rbowen<tr><th>lbstatus</th>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data">-25</td>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data">0</td>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data"><em>-25</em></td>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick <td class="data">50</td></tr>
9a367ec3d570bcbaf8923dad66cb3b1532963964trawick<tr><th>lbstatus</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">0</td>
5ae30adbe59946de742ab0cd6be3b7457471a698takashi <td class="data">0</td>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">0</td>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data"><em>0</em></td></tr>
fc0e302cc26d443c3441238f00e7b5a201b3bbb9rbowen<tr><td class="data" colspan="5">(repeat)</td></tr>
fc0e302cc26d443c3441238f00e7b5a201b3bbb9rbowen</table>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <p>That is it schedules: <var>a</var> <var>c</var> <var>d</var>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <var>a</var> <var>c</var> <var>d</var> <var>a</var> <var>c</var>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf <var>d</var> ... Please note that:</p>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <table><tr><th>worker</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">a</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">b</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">c</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">d</th></tr>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<tr><th>lbfactor</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">25</td>
1f6b6946407b900ccef68a0e9cd8baa0eba429e8rbowen <td class="data">25</td>
1f6b6946407b900ccef68a0e9cd8baa0eba429e8rbowen <td class="data">25</td>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <td class="data">25</td></tr>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess</table>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>Has the exact same behavior as:</p>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <table><tr><th>worker</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">a</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">b</th>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <th class="data">c</th>
5a58787efeb02a1c3f06569d019ad81fd2efa06end <th class="data">d</th></tr>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<tr><th>lbfactor</th>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd <td class="data">1</td>
d05d0eb4ae6d2a5e513fc3bf2555ce33da416634nd <td class="data">1</td>
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd <td class="data">1</td>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi <td class="data">1</td></tr>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi</table>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
50039065d571fe01fd458a3f031c995a1fd53c22rbowen <p>This is because all values of <dfn>lbfactor</dfn> are normalized
5a58787efeb02a1c3f06569d019ad81fd2efa06end with respect to the others. For:</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end
<table><tr><th>worker</th>
<th class="data">a</th>
<th class="data">b</th>
<th class="data">c</th></tr>
<tr><th>lbfactor</th>
<td class="data">1</td>
<td class="data">4</td>
<td class="data">1</td></tr>
</table>
<p>worker <var>b</var> will, on average, get 4 times the requests
that <var>a</var> and <var>c</var> will.</p>
<p>The following asymmetric configuration works as one would expect:</p>
<table><tr><th>worker</th>
<th class="data">a</th>
<th class="data">b</th></tr>
<tr><th>lbfactor</th>
<td class="data">70</td>
<td class="data">30</td></tr>
<tr><td class="data" colspan="2">&nbsp;</td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>-30</em></td>
<td class="data">30</td></tr>
<tr><th>lbstatus</th>
<td class="data">40</td>
<td class="data"><em>-40</em></td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>10</em></td>
<td class="data">-10</td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>-20</em></td>
<td class="data">20</td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>-50</em></td>
<td class="data">50</td></tr>
<tr><th>lbstatus</th>
<td class="data">20</td>
<td class="data"><em>-20</em></td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>-10</em></td>
<td class="data">10</td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>-40</em></td>
<td class="data">40</td></tr>
<tr><th>lbstatus</th>
<td class="data">30</td>
<td class="data"><em>-30</em></td></tr>
<tr><th>lbstatus</th>
<td class="data"><em>0</em></td>
<td class="data">0</td></tr>
<tr><td class="data" colspan="3">(repeat)</td></tr>
</table>
<p>That is after 10 schedules, the schedule repeats and 7 <var>a</var>
are selected with 3 <var>b</var> interspersed.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="traffic" id="traffic">Weighted Traffic Counting Algorithm</a></h2>
<p>Enabled via <code>lbmethod=bytraffic</code>, the idea behind this
scheduler is very similar to the Request Counting method, with
the following changes:</p>
<p><dfn>lbfactor</dfn> is <em>how much traffic, in bytes, we want
this worker to handle</em>. This is also a normalized value
representing their "share" of the amount of work to be done,
but instead of simply counting the number of requests, we take
into account the amount of traffic this worker has seen.</p>
<p>If a balancer is configured as follows:</p>
<table><tr><th>worker</th>
<th class="data">a</th>
<th class="data">b</th>
<th class="data">c</th></tr>
<tr><th>lbfactor</th>
<td class="data">1</td>
<td class="data">2</td>
<td class="data">1</td></tr>
</table>
<p>Then we mean that we want <var>b</var> to process twice the
amount of bytes than <var>a</var> or <var>c</var> should. It does
not necessarily mean that <var>b</var> would handle twice as
many requests, but it would process twice the I/O. Thus, the
size of the request and response are applied to the weighting
and selection algorithm.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="environment" id="environment">Exported Environment Variables</a></h2>
<p>At present there are 6 environment variables exported:</p>
<dl>
<dt><var><a name="balancer_session_sticky" id="balancer_session_sticky">BALANCER_SESSION_STICKY</a></var></dt>
<dd>
<p>This is assigned the <var>stickysession</var> value used in the current
request. It is the cookie or parameter name used for sticky sessions</p>
</dd>
<dt><var><a name="balancer_session_route" id="balancer_session_route">BALANCER_SESSION_ROUTE</a></var></dt>
<dd>
<p>This is assigned the <var>route</var> parsed from the current
request.</p>
</dd>
<dt><var><a name="balancer_name" id="balancer_name">BALANCER_NAME</a></var></dt>
<dd>
<p>This is assigned the name of the balancer used for the current
request. The value is something like <code>balancer://foo</code>.</p>
</dd>
<dt><var><a name="balancer_worker_name" id="balancer_worker_name">BALANCER_WORKER_NAME</a></var></dt>
<dd>
<p>This is assigned the name of the worker used for the current request.
The value is something like <code>http://hostA:1234</code>.</p>
</dd>
<dt><var><a name="balancer_worker_route" id="balancer_worker_route">BALANCER_WORKER_ROUTE</a></var></dt>
<dd>
<p>This is assigned the <var>route</var> of the worker that will be
used for the current request.</p>
</dd>
<dt><var><a name="balancer_route_changed" id="balancer_route_changed">BALANCER_ROUTE_CHANGED</a></var></dt>
<dd>
<p>This is set to 1 if the session route does not match the
worker route (BALANCER_SESSION_ROUTE != BALANCER_WORKER_ROUTE) or the
session does not yet have an established route. This can be used to
determine when/if the client needs to be sent an updated route
when sticky sessions are used.</p>
</dd>
</dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="enable" id="enable">Enabling Balancer Manager Support</a></h2>
<p>This module <em>requires</em> the service of
<code class="module"><a href="/mod/mod_status.html">mod_status</a></code>.
Balancer manager enables dynamic update of balancer
members. You can use balancer manager to change the balance
factor or a particular member, or put it in the off line
mode.
</p>
<p>Thus, in order to get the ability of load balancer management,
<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>
have to be present in the server.</p>
<p>To enable load balancer management for browsers from the foo.com
domain add this code to your <code>httpd.conf</code>
configuration file</p>
<div class="example"><p><code>
&lt;Location /balancer-manager&gt;<br />
SetHandler balancer-manager<br />
<br />
Order Deny,Allow<br />
Deny from all<br />
Allow from .foo.com<br />
&lt;/Location&gt;
</code></p></div>
<p>You can now access load balancer manager by using a Web browser
to access the page
<code>http://your.server.name/balancer-manager</code></p>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_balancer.html" title="English">&nbsp;en&nbsp;</a> |
<a href="/ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2006 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<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>
</body></html>