GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing httpd.apache.org — mod_proxy_balancer - Apache HTTP Server Version 2.4 Apache Module mod_proxy_balancer
SummaryThis module requires the service of
The Load balancing scheduler algorithm is not provided by this module but from other ones such as: Thus, in order to get the ability of load balancing,
WarningDo not enable proxying until you have secured your server. Open proxy servers are dangerous both to your network and to the Internet at large. Topics
DirectivesThis module provides no directives. Bugfix checklistSee alsoLoad balancer scheduler algorithm ¶At present, there are 4 load balancer scheduler algorithms available
for use: Request Counting ( Load balancer stickiness ¶The balancer supports stickiness. When a request is proxied to some back-end, then all following requests from the same user should be proxied to the same back-end. Many load balancers implement this feature via a table that maps client IP addresses to back-ends. This approach is transparent to clients and back-ends, but suffers from some problems: unequal load distribution if clients are themselves hidden behind proxies, stickiness errors when a client uses a dynamic IP address that changes during a session and loss of stickiness, if the mapping table overflows. The module Examples of a balancer configuration ¶Before we dive into the technical details, here's an example of
how you might use <Proxy "balancer://mycluster">
BalancerMember "http://192.168.1.50:80"
BalancerMember "http://192.168.1.51:80"
</Proxy>
ProxyPass "/test" "balancer://mycluster"
ProxyPassReverse "/test" "balancer://mycluster"
Another example of how to provide load balancing with stickiness
using Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://mycluster">
BalancerMember "http://192.168.1.50:80" route=1
BalancerMember "http://192.168.1.51:80" route=2
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass "/test" "balancer://mycluster"
ProxyPassReverse "/test" "balancer://mycluster"
Exported Environment Variables ¶At present there are 6 environment variables exported:
Enabling Balancer Manager Support ¶This module requires the service of
Thus, in order to get the ability of load balancer management,
To enable load balancer management for browsers from the example.com
domain add this code to your <Location "/balancer-manager">
SetHandler balancer-manager
Require host example.com
</Location>
You can now access load balancer manager by using a Web browser
to access the page
Details on load balancer stickiness ¶When using cookie based stickiness, you need to configure the
name of the cookie that contains the information about which back-end
to use. This is done via the stickysession attribute added
to either Some back-ends use a slightly different form of stickiness cookie,
for instance Apache Tomcat. Tomcat adds the name of the Tomcat instance
to the end of its session id cookie, separated with a dot ( The second way of implementing stickiness is URL encoding.
The web server searches for a query parameter in the URL of the request.
The name of the parameter is specified again using stickysession.
The value of the parameter is used to lookup a member worker with route
equal to that value. Since it is not easy to extract and manipulate all
URL links contained in responses, generally the work of adding the parameters
to each link is done by the back-end generating the content.
In some cases it might be feasible doing
this via the web server using The Java standards implement URL encoding slightly different. They use
a path info appended to the URL using a semicolon ( Finally you can support cookies and URL encoding at the same time, by
configuring the name of the cookie and the name of the URL parameter
separated by a vertical bar ( ProxyPass "/test" "balancer://mycluster" stickysession=JSESSIONID|jsessionid scolonpathdelim=On
<Proxy "balancer://mycluster">
BalancerMember "http://192.168.1.50:80" route=node1
BalancerMember "http://192.168.1.51:80" route=node2
</Proxy>
If the cookie and the request parameter both provide routing information for the same request, the information from the request parameter is used. Troubleshooting load balancer stickiness ¶If you experience stickiness errors, e.g. users lose their application sessions and need to login again, you first want to check whether this is because the back-ends are sometimes unavailable or whether your configuration is wrong. To find out about possible stability problems with the back-ends, check your Apache error log for proxy error messages. To verify your configuration, first check, whether the stickiness
is based on a cookie or on URL encoding. Next step would be logging
the appropriate data in the access log by using an enhanced
Common reasons for loss of session are session timeouts, which are usually configurable on the back-end server. The balancer also logs detailed information about handling
stickiness to the error log, if the log level is set to
| ||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |