Mailing List Archive

Apache 2.4 Balancer still sends requests to the server with status "Init Err"
Hello everybody.

I use Apache 2.4.37 on Red Hat as balancer for two Tomcat servers. We have this configuration of balancer:
<Proxy balancer://tomcat-cluster>
BalancerMember https://192.168.1.40:8443 route=TOMCAT_SRV1 timeout=60 ping=1ms
BalancerMember https://192.168.1.50:8443 route=TOMCAT_SRV2 timeout=60 ping=500ms
ProxySet stickysession=JSESSIONID|jsessionid
ProxySet lbmethod=byrequests
ProxySet nofailover=off
</Proxy>
For testing reasons, I have reduced the ping value to 1 ms for one server.

During test calls Load Balancer Manager shows server status "Init Err" and Apache error log shows these errors:
[Tue Oct 31 17:01:38.075395 2023] [proxy_http:error] [pid 151375:tid 140535126157056] (70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:33855] AH01102: error reading status line from remote server 192.168.1.40:8443, referer: https://xy
[Tue Oct 31 17:01:38.075453 2023] [proxy:error] [pid 151375:tid 140535126157056] [client xxx.xxx.xxx.xxx:33855] AH00898: Timeout on 100-Continue returned by /tomcat, referer: https://xy

But I can still see requests from Apache in the request log of the server 192.168.1.40. How do I configure the load balancer to stop sending requests to the server 192.168.1.40 for a defined period of time after detecting the "Init Err" status and only send them to the other server in the cluster? Thank you very much in advance for your help.

Best regards,

Fica

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache 2.4 Balancer still sends requests to the server with status "Init Err" [ In reply to ]
El mié, 1 nov 2023 a las 8:32, <ficajar@seznam.cz> escribió:

> Hello everybody.
>
> I use Apache 2.4.37 on Red Hat as balancer for two Tomcat servers. We have
> this configuration of balancer:
> <Proxy balancer://tomcat-cluster>
> BalancerMember https://192.168.1.40:8443 route=TOMCAT_SRV1 timeout=60
> ping=1ms
> BalancerMember https://192.168.1.50:8443 route=TOMCAT_SRV2 timeout=60
> ping=500ms
> ProxySet stickysession=JSESSIONID|jsessionid
> ProxySet lbmethod=byrequests
> ProxySet nofailover=off
> </Proxy>
> For testing reasons, I have reduced the ping value to 1 ms for one server.
>
> During test calls Load Balancer Manager shows server status "Init Err" and
> Apache error log shows these errors:
> [Tue Oct 31 17:01:38.075395 2023] [proxy_http:error] [pid 151375:tid
> 140535126157056] (70007)The timeout specified has expired: [client
> xxx.xxx.xxx.xxx:33855] AH01102: error reading status line from remote
> server 192.168.1.40:8443, referer: https://xy
> [Tue Oct 31 17:01:38.075453 2023] [proxy:error] [pid 151375:tid
> 140535126157056] [client xxx.xxx.xxx.xxx:33855] AH00898: Timeout on
> 100-Continue returned by /tomcat, referer: https://xy
>
> But I can still see requests from Apache in the request log of the server
> 192.168.1.40. How do I configure the load balancer to stop sending requests
> to the server 192.168.1.40 for a defined period of time after detecting the
> "Init Err" status and only send them to the other server in the cluster?
> Thank you very much in advance for your help.
>
>
"failontimeout" by default is off, you may want to turn it on for your
testing purposes.


--
Daniel Ferradal
HTTPD Project
#httpd help at Libera.Chat
Re: Apache 2.4 Balancer still sends requests to the server with status "Init Err" [ In reply to ]
Hello Daniel,

Thank you very much for your advice. Based on it I modified the configuration:
<Proxy balancer://tomcat-cluster>
BalancerMember https://192.168.1.40:8443 route=TOMCAT_SRV1 timeout=10 retry=30
BalancerMember https://192.168.1.50:8443 route=TOMCAT_SRV2 timeout=10 retry=30
ProxySet stickysession=JSESSIONID|jsessionid
ProxySet lbmethod=byrequests
ProxySet failontimeout=on
ProxySet failonstatus=500,502,503
ProxySet forcerecovery=off
ProxySet nofailover=off
</Proxy>
I removed ping parameter because it does not work for GET requests.

Now when the first server is in "bad condition" (192.168.1.40:8443 is available, but the server does not respond), Apache waits 10 s and than it sends 502 error to client, instead of using the second server. What is wrong? Thanks in advance.

Best regards,
Fica

On 2023/11/01 10:24:54 Daniel Ferradal wrote:
> El mié, 1 nov 2023 a las 8:32, <fi...@seznam.cz> escribió:
>
> > Hello everybody.
> >
> > I use Apache 2.4.37 on Red Hat as balancer for two Tomcat servers. We have
> > this configuration of balancer:
> > <Proxy balancer://tomcat-cluster>
> > BalancerMember https://192.168.1.40:8443 route=TOMCAT_SRV1 timeout=60
> > ping=1ms
> > BalancerMember https://192.168.1.50:8443 route=TOMCAT_SRV2 timeout=60
> > ping=500ms
> > ProxySet stickysession=JSESSIONID|jsessionid
> > ProxySet lbmethod=byrequests
> > ProxySet nofailover=off
> > </Proxy>
> > For testing reasons, I have reduced the ping value to 1 ms for one server.
> >
> > During test calls Load Balancer Manager shows server status "Init Err" and
> > Apache error log shows these errors:
> > [Tue Oct 31 17:01:38.075395 2023] [proxy_http:error] [pid 151375:tid
> > 140535126157056] (70007)The timeout specified has expired: [client
> > xxx.xxx.xxx.xxx:33855] AH01102: error reading status line from remote
> > server 192.168.1.40:8443, referer: https://xy
> > [Tue Oct 31 17:01:38.075453 2023] [proxy:error] [pid 151375:tid
> > 140535126157056] [client xxx.xxx.xxx.xxx:33855] AH00898: Timeout on
> > 100-Continue returned by /tomcat, referer: https://xy
> >
> > But I can still see requests from Apache in the request log of the server
> > 192.168.1.40. How do I configure the load balancer to stop sending requests
> > to the server 192.168.1.40 for a defined period of time after detecting the
> > "Init Err" status and only send them to the other server in the cluster?
> > Thank you very much in advance for your help.
> >
> >
> "failontimeout" by default is off, you may want to turn it on for your
> testing purposes.
>
>
> --
> Daniel Ferradal
> HTTPD Project
> #httpd help at Libera.Chat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache 2.4 Balancer still sends requests to the server with status "Init Err" [ In reply to ]
El vie, 3 nov 2023 a las 9:36, <ficajar@seznam.cz> escribió:

>
>
> Now when the first server is in "bad condition" (192.168.1.40:8443 is
> available, but the server does not respond), Apache waits 10 s and than it
> sends 502 error to client, instead of using the second server. What is
> wrong? Thanks in advance.
>
>
timeout is making it wait 10 seconds to see if server responds in that time
because it is taking long to answer but has accepted the connection, if you
want to make it wait less, adjust it.

AFAIK, httpd does not send the request to the other balancer member until
the first has failed, so at least you will get one failure for 30 seconds
and a wait of 10 every time httpd retries a backend that is failing.

Someone may correct me though, but I haven't managed with your setup,
perhaps reaching this point you can try with mod_proxy_hcheck. Although
timeouts are tricky.

--
Daniel Ferradal
HTTPD Project
#httpd help at Libera.Chat
Re: Apache 2.4 Balancer still sends requests to the server with status "Init Err" [ In reply to ]
On Wed, Nov 1, 2023 at 3:55?PM Daniel Ferradal <dferradal@apache.org> wrote:
>
>
>
> El mié, 1 nov 2023 a las 8:32, <ficajar@seznam.cz> escribió:
>>
>> Hello everybody.
>>
>> I use Apache 2.4.37 on Red Hat as balancer for two Tomcat servers. We have this configuration of balancer:
>> <Proxy balancer://tomcat-cluster>
>> BalancerMember https://192.168.1.40:8443 route=TOMCAT_SRV1 timeout=60 ping=1ms
>> BalancerMember https://192.168.1.50:8443 route=TOMCAT_SRV2 timeout=60 ping=500ms
>> ProxySet stickysession=JSESSIONID|jsessionid
>> ProxySet lbmethod=byrequests
>> ProxySet nofailover=off
>> </Proxy>
>> For testing reasons, I have reduced the ping value to 1 ms for one server.
>>
>> During test calls Load Balancer Manager shows server status "Init Err" and Apache error log shows these errors:
>> [Tue Oct 31 17:01:38.075395 2023] [proxy_http:error] [pid 151375:tid 140535126157056] (70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:33855] AH01102: error reading status line from remote server 192.168.1.40:8443, referer: https://xy
>> [Tue Oct 31 17:01:38.075453 2023] [proxy:error] [pid 151375:tid 140535126157056] [client xxx.xxx.xxx.xxx:33855] AH00898: Timeout on 100-Continue returned by /tomcat, referer: https://xy
>>
>> But I can still see requests from Apache in the request log of the server 192.168.1.40. How do I configure the load balancer to stop sending requests to the server 192.168.1.40 for a defined period of time after detecting the "Init Err" status and only send them to the other server in the cluster? Thank you very much in advance for your help.
>>
This can be achieved by using the "retry" parameter. Apache will not
forward any request to the backend server(which is in error state)
until retry timeout expires. By default this value is 60 sec. You may
need to adjust it.

https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#balancermember

>
> "failontimeout" by default is off, you may want to turn it on for your testing purposes.
>
>
> --
> Daniel Ferradal
> HTTPD Project
> #httpd help at Libera.Chat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache 2.4 Balancer still sends requests to the server with status "Init Err" [ In reply to ]
Hello,

Thank you all for your help. The basic functions work (the important thing is the combination of timeout and failontimeout=on). I will tune up the appropriate settings for the parameters.

Fica

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org