Linux – Understanding mod_proxy_balancer module of apache

apache-2.2linux

I am trying to setup a load balancer for few webservers. I am using centos 5.6 with apache http server (Server version: Apache/2.2.3). I am having a client generator which generates around 200 threads and try to browse through the webpage via the load balancer. I used the apache mod_proxy_balancer for this purpose. This is my setup :

<IfModule mod_proxy_balancer.c>
   <Proxy balancer://xx.xx.xx.xx>
         BalancerMember yy.yy.yy.yy loadfactor=1
         BalancerMember zz.zz.zz.zz loadfactor=1
   </Proxy>

   <Location />
         ProxyPass       balancer://xx.xx.xx.xx/
   </Location>
</IfModule>

After the start, in few minutes I start seeing 503 errors on the client side, The apache error logs read :

[Mon Aug 22 10:19:09 2011] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to yy.yy.yy.yy:80 failed

[Mon Aug 22 10:19:09 2011] [error] ap_proxy_connect_backend disabling worker for (yy.yy.yy.yy)

[Mon Aug 22 10:19:10 2011] [error] proxy: BALANCER: (balancer://xx.xx.xx.xx). All workers are in error state

I changed the timeout period in the httpd.conf to 1200 and im still experiencing the same issue. I can understand that there is a timeout and it marks the ip as in error state and retries to connect after a specific time (60 seconds as per the document). It connects and continues to function well for few more minutes and this process goes on in a loop. I want to know how to fix this issue and understand what causes the timeout. If I connect the client directly to one of the backend servers , it works fine . Thus , I guess the loadbalancer causes the bottleneck. Any information to help me understand or solve this issue is greatly appreciated. Thank you !

  • Sethu

Best Answer

I am usually doing this with AJP and JBoss app server, but I have configured it something like this:

<Proxy balancer://ajpcluster>     
  BalancerMember ajp://test.local.host:8109     
  BalancerMember ajp://test.local.host:8209   
</Proxy>
<Location /jconsole >  
  ProxyPass balancer://ajpcluster/jconsole stickysession=JSESSIONID|jsessionid nofailover=On
  ProxyPassReverse balancer://ajpcluster/jconsole
</Location>
Related Topic