mod_proxy_balancer.html.en revision 4c881d2fffa365e2e0c5e25eb1cf77f4f9406e44
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<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>
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<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
d05d0eb4ae6d2a5e513fc3bf2555ce33da416634nd<div id="preamble"><h1>Apache Module mod_proxy_balancer</h1>
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_balancer.html" title="English"> en </a> |
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi<a href="/ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
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 <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>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 <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 id="quickview"><h3 class="directives">Directives</h3>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<p>This module provides no
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf directives.</p>
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>
60a4b2c422dcbb08a554fb193105c08da592718bpoirier<li><code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></li>
60a4b2c422dcbb08a554fb193105c08da592718bpoirier<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6e14faf37935e36804b8bad802bc9dd58f3cf65dsf<h2><a name="scheduler" id="scheduler">Load balancer scheduler algorithm</a></h2>
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</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess<h2><a name="requests" id="requests">Request Counting Algorithm</a></h2>
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 <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 <p><dfn>lbstatus</dfn> is <em>how urgent this worker has to work
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 <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 <p>If some workers are disabled, the others will
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess still be scheduled correctly.</p>
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 > candidate lbstatus
5a58787efeb02a1c3f06569d019ad81fd2efa06end candidate = worker
fefb8b844b6286bfc41bb2e0c4cc003b8e7d4ff2kess <p>And <var>b</var> gets disabled, the following schedule is produced:</p>
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>
50039065d571fe01fd458a3f031c995a1fd53c22rbowen <p>This is because all values of <dfn>lbfactor</dfn> are normalized
5a58787efeb02a1c3f06569d019ad81fd2efa06end with respect to the others. For:</p>
<dt><var><a name="balancer_session_sticky" id="balancer_session_sticky">BALANCER_SESSION_STICKY</a></var></dt>
<dt><var><a name="balancer_session_route" id="balancer_session_route">BALANCER_SESSION_ROUTE</a></var></dt>
<dt><var><a name="balancer_worker_name" id="balancer_worker_name">BALANCER_WORKER_NAME</a></var></dt>
<dt><var><a name="balancer_worker_route" id="balancer_worker_route">BALANCER_WORKER_ROUTE</a></var></dt>
<dt><var><a name="balancer_route_changed" id="balancer_route_changed">BALANCER_ROUTE_CHANGED</a></var></dt>
<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>
<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_balancer.html" title="English"> en </a> |
<a href="/ja/mod/mod_proxy_balancer.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
<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>