I need to know if apache can wisely and automatically detect if one of it's balanerMembers is down and consequently exempt it from serving the requests?

P.S. The back-end servers won't produce heartbeat.


Comments: I'm using mod_proxy in apache 2.4.7 My configuration for a sample site is like below, My problem is when one of the back-end servers goes unresponsive, My load balancer still sends requests to the dead back-end server and clients are complaining. What is wrong with the below config:

<Proxy balancer://X_Balancer>
    BalancerMember http://firsthost.sth/ status=-SE
    BalancerMember http://anotherhost.sth/ status=-SE
    ProxySet lbmethod=bybusyness
<VirtualHost IPofloadbalancer:80>
    ServerName domainname
    SSLProxyEngine On
    Include /*/modsecurity.conf
    <location />
        ProxyPass balancer://X_Balancer/
        ProxyPassReverse balancer://X_Balancer/

If you use mod_proxy in Apache 2.2 you have limited configuration options, but Apache will detect unresponsive balancerMembers and distribute requests to any remaining balancerMembers.

Apache 2.4 has already some more options, but for more advanced options you're typically better off with more specialized load balancer software.

After your comments: It depends on how the balancerMember stops responding. If a connection can still be made, but no error code and no response is forthcoming you might benefit from setting the timeout and failontimeout options.

<Proxy balancer://X_Balancer>
    BalancerMember http://firsthost.sth/ status=-SE timeout=5 retry=60
    BalancerMember http://anotherhost.sth/ status=-SE timeout=5 retry=60
    ProxySet lbmethod=bybusyness failontimeout=on

timeout=5 Connection timeout in seconds. The number of seconds Apache httpd waits for data sent by / to the backend.
failontimeout=on If set, an IO read timeout after a request is sent to the backend will force the worker into error state. Worker recovery behaves the same as other worker errors.

  • O.K. thanks for your help. I will try those directions too, but in the mean time I want to ask you the following question: does the apache load balancer will detect if the back-end server comes back in service or the balancerMember will stay in the error state constantly? – Ehsan Mahdavi Jul 2 '14 at 14:38
  • The retry=60 will leave a BalancerMember that is in error state alone for 60 seconds, after that it will try to connect again and if that then succeeds the error condition is flushed and the BalancerMember is added again to the active pool. – HBruijn Jul 2 '14 at 14:40
  • 1
    still doesn't work!!! apache still tries 2 send requests to the crashed back-end server!!! – Ehsan Mahdavi Jul 3 '14 at 12:02
  • Same here. And I am running version 2.4 – Darek Sep 17 '18 at 18:31

BalancerMember http://firsthost.sth/ connectiontimeout=5 retry=5 ping=2
BalancerMember http://anotherhost.sth/ connectiontimeout=5 retry=5 ping=2

Try it in the above direction! Review the changes to ajp protocols.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.