I have setup a load balancer with Apache 2.2 via mod_proxy and mod_proxy_balancer. The load balancing works just fine, but there is one case I cannot find any configuration options for, namely, while using persistent connections to the backend servers, when one of them dies (shuts down, crashes, etc ), the existing connections to it still try to access it. Is there a way to configure the apache Load Balancer so that it quits or recreates connections to dead backend servers? In the LVS world the Ldirector has an option under Proc FS that governs just that:


When this is set persisten sessions / connections ot a dead backend server will be flushed so that on the next client request they can be recreated.

Is there something similar to it in the Apache world?

Thanks in adavnce!

Cheers, Konstantin Boyanov

P.S. In what manner does Apache check the status of the backend servers? Does it try to connect to some port or something like that? It would be great if someone can shed some ligjt on that too!

Here is my virtual host configuration file:

ServerAdmin admin@mysite.com ServerName myapp.mysite.com

DocumentRoot /srv/www/vhosts/myapp.mysite.com

ErrorLog /var/log/apache2/myapp.mysite.com-error_log
CustomLog /var/log/apache2/myapp.mysite.com-access_log combined

HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/vhosts/myapp.mysite.com/cgi-bin/"

<Location /balancer-manager>
    SetHandler balancer-manager
    Order Deny,Allow
    Deny from all
    Allow from all

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from bmf.intern.netz

<Proxy balancer://myapp>
    BalancerMember loadfactor=10 route=1 connectiontimeout=200ms
    BalancerMember loadfactor=10 route=2 connectiontimeout=200ms
    ProxySet stickysession=ROUTEID
    ProxySet lbmethod=byrequests

ProxyPass /balancer-manager !
ProxyPass /server-status !
ProxyPass / balancer://myapp/ lbmethod=byrequests
ProxyPassReverse / balancer://myapp/

<Directory "/srv/www/vhosts/myapp.mysite.com/cgi-bin">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all

<IfModule mod_userdir.c>
    UserDir public_html
    Include /etc/apache2/mod_userdir.conf

# This should be changed to whatever you set DocumentRoot to.
<Directory "/srv/www/vhosts/myapp.mysite.com">

    Options Indexes FollowSymLinks
    AllowOverride None

    Order allow,deny
    Allow from all


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.