Re: How to wait some time before retry?

2019-09-27 Thread Patrick Hemmer




*From:* Marco Colli [mailto:collimarc...@gmail.com]
*Sent:* Friday, September 27, 2019, 07:21 EDT
*To:* HAProxy 
*Subject:* How to wait some time before retry?

Still have this issue and I cannot find a solution. It would be great 
to have an option "wait time before retry" in the next versions of 
HAProxy (instead of the fixed value of 1 sec).


On Mon, Sep 16, 2019 at 2:03 PM Marco Colli wrote:


Hello!

I have a question about HAProxy configuration. Maybe someone has a
solution ;)

I have a HAProxy (v2.0) load balancer in front of many web servers.

When I restart the web servers the TCP socket remains closed for a
few seconds (~10s). For this reason I would like to retry failed
attempts to connect after some seconds.

I already use |option redispatch|, however it seems that does not
solve my issue. The problem is that the request is retried
immediately (after 1s), thus causing all the retries to fail. From
the HAProxy docs:

In order to avoid immediate reconnections to a server which is
restarting, a turn-around timer of min("timeout connect", one
second) is applied before a retry occurs.

Is there any option to wait some more time (e.g. 10s) before
retrying? Or do you have any other solution?




Not the cleanest solution, but something that could work would be to add 
a lua action to sleep for 10 seconds on the response when you have a 
connect error, and then override the response to a 307 (or perhaps 302) 
redirect back to the same location. This will then cause the browser to 
retry the request.



-Patrick


Re: How to wait some time before retry?

2019-09-27 Thread Marco Colli
I have already set "timeout connect" to 10s, but it doesn't work. I think
because the connection is *immediately rejected* by the OS (Ubuntu) if
there isn't any process listening on it (i.e. during the Puma server
restart).

On Fri, Sep 27, 2019 at 2:11 PM Lukas Tribus  wrote:

> Ciao Marco,
>
>
>
> On Fri, Sep 27, 2019 at 1:21 PM Marco Colli 
> wrote:
> >
> > Still have this issue and I cannot find a solution. It would be great to
> have an option "wait time before retry" in the next versions of HAProxy
> (instead of the fixed value of 1 sec).
>
> Why not raise "timeout connect" to 10s in your configuration?
>
>
> Lukas
>


Re: How to wait some time before retry?

2019-09-27 Thread Lukas Tribus
Ciao Marco,



On Fri, Sep 27, 2019 at 1:21 PM Marco Colli  wrote:
>
> Still have this issue and I cannot find a solution. It would be great to have 
> an option "wait time before retry" in the next versions of HAProxy (instead 
> of the fixed value of 1 sec).

Why not raise "timeout connect" to 10s in your configuration?


Lukas



Re: How to wait some time before retry?

2019-09-27 Thread Marco Colli
Still have this issue and I cannot find a solution. It would be great to
have an option "wait time before retry" in the next versions of HAProxy
(instead of the fixed value of 1 sec).

On Mon, Sep 16, 2019 at 2:03 PM Marco Colli  wrote:

> Hello!
>
> I have a question about HAProxy configuration. Maybe someone has a
> solution ;)
>
> I have a HAProxy (v2.0) load balancer in front of many web servers.
>
> When I restart the web servers the TCP socket remains closed for a few
> seconds (~10s). For this reason I would like to retry failed attempts to
> connect after some seconds.
>
> I already use option redispatch, however it seems that does not solve my
> issue. The problem is that the request is retried immediately (after 1s),
> thus causing all the retries to fail. From the HAProxy docs:
>
> In order to avoid immediate reconnections to a server which is restarting,
> a turn-around timer of min("timeout connect", one second) is applied before
> a retry occurs.
>
> Is there any option to wait some more time (e.g. 10s) before retrying? Or
> do you have any other solution?
>
>