My problem was not about the timeout: the health check started to work as desired once I set a ProxyHCExpr
.
I noticed this by looking at the requests made to the status page on the backend nodes: only after I defined a ProxyHCExpr
did they arrive more or less regularly every second. Note that I don't need to use the expression, adding hcexpr=23
, but an expression needs to be set anyway in order for mod_proxy_hcheck to do its job. I would have expected that either it could be safely omitted or that apachectl -t
would throw an error or warning.
In the docs, it says:
hcexpr
Name of expression, created via ProxyHCExpr, used to check
response headers for health. If not used, 2xx thru 3xx status codes
imply success
Based on this, I had wrongly assumed that setting ProxyHCExpr
would also be optional. Unfortunately, it was not working as desired until I set it. My configuration file went from:
<Proxy "balancer://tomcat">
BalancerMember "http://10.0.0.1:8080" hcmethod=HEAD hcinterval=1 hcpasses=9 hcuri=/app/status
BalancerMember "http://10.0.0.2:8080" hcmethod=HEAD hcinterval=1 hcpasses=9 hcuri=/app/status
</Proxy>
To:
ProxyHCExpr 23 {%{REQUEST_STATUS} =~ /^[23]/}
<Proxy "balancer://ifis-tomcat-col">
BalancerMember "http://10.0.0.1:8080" hcmethod=HEAD hcinterval=1 hcpasses=9 hcuri=/app/status
BalancerMember "http://10.0.0.2:8080" hcmethod=HEAD hcinterval=1 hcpasses=9 hcuri=/app/status
</Proxy>
This was the configuration as seen from the balancer-manager:
MaxMembers StickySession DisableFailover Timeout FailoverAttempts Method Path Active
2 [2 Used] (None) Off 0 1 bybusyness /app Yes
Worker URL Route RouteRedir Factor Set Status Elected Busy Load To From HC Method HC Interval Passes Fails HC uri HC Expr
http://10.0.0.1:8080 1.00 0 Init Ok 0 0 0 0 0 HEAD 1000ms 9 (0) 1 (0) /app/status
http://10.0.0.2:8080 1.00 0 Init Ok 0 0 0 0 0 HEAD 1000ms 9 (0) 1 (0) /app/status
Then it became:
MaxMembers StickySession DisableFailover Timeout FailoverAttempts Method Path Active
2 [2 Used] (None) Off 0 1 bybusyness /app Yes
Worker URL Route RouteRedir Factor Set Status Elected Busy Load To From HC Method HC Interval Passes Fails HC uri HC Expr
http://10.0.0.1:8080 1.00 0 Init Ok 0 0 0 0 0 HEAD 1000ms 9 (0) 1 (0) /app/status
http://10.0.0.2:8080 1.00 0 Init Ok 0 0 0 0 0 HEAD 1000ms 9 (0) 1 (0) /app/status
Health check cond. expressions:
Expr name Expression
23 %{REQUEST_STATUS} =~ /^[23]/