Can apache proxy/load balancer redirect requests to other available balancer member when it gets timeout from a hanging server

apache-2.4load balancing

I am using apache2.4.6 and tomcat8 to implement a load balance solution.

I'd like to know whether apache balancer will redirect requests to another balancer member if it gets timeout error from one server.

For example, apache sends one request to tomcat1 but tomcat1 cannot respond within 10 seconds, will apache resend this request to tomcat2?

Below is my configuration for apache proxy balancer.

<Proxy balancer://myCluster timeout=10 failontimeout=on>
    BalancerMember http://server1:8080 route=tomcat1 loadfactor=1 timeout=10 retry=30
    BalancerMember http://server2:8080 route=tomcat2 loadfactor=1 timeout=10 retry=30

    ProxySet lbmethod=byrequests
   # ProxySet stickysession=JSESSIONID

    Order Deny,Allow
    Deny from none
    Allow from all
 </Proxy>

Best Answer

I belive you can achieve this feature by using second tomcat server as a hot standby. This is supported with mod_proxy in apache

You can try following configuration & test it.

<Proxy balancer://myCluster timeout=10 failontimeout=on>
    BalancerMember http://server1:8080 route=tomcat1 loadfactor=1 timeout=10 retry=30
    BalancerMember http://server2:8080 route=tomcat2 loadfactor=1 timeout=10 retry=30 status=+H

    ProxySet lbmethod=byrequests
   # ProxySet stickysession=JSESSIONID

    Order Deny,Allow
    Deny from none
    Allow from all
 </Proxy>
Related Topic