Hello Lukas,

On Mon, Oct 15, 2018 at 6:14 PM Lukas Tribus <[email protected]> wrote:

> Hello Sébastien,
>
>
> On Mon, 15 Oct 2018 at 16:40, Sébastien Kurtzemann <[email protected]> wrote:
> >> No. Only *restart* closes existing front and backend connections.
> >> Reload (both seamless and regular) closes them gracefully, so no
> >> request is lost.
> >
> >
> > Okay. I think I confound connections and servers sessions... :(
> > Are sessions purged after a seamless reload ?
> >
> > So is there a way to keep sessions states or to configure haproxy TCP
> backends to not send a request to a server that is currently handling a
> connection ?
>
> When haproxy reloads, and your backend server is configured with
> maxconn 1 on haproxy:
> - the old process will keep 1 connection open to your server, until
> all old requests are served (so connections close and the process
> exits)
> - the new process will open the 1 connection when the first request comes
> in
>
> So there is a moment when both old and new process are running, where
> there are actually 2 connections to your backend server (one from the
> old haproxy process, one from the new process).
> If you don't want that, you cannot reload, you must restart instead.
> This will kill the existing session immediately, only allowing for the
> new connection.
>
> There is no way to keep the same TCP session alive across haproxy
> reloads or restarts. The old connection must go away and a new
> connection must be opened. When you restart, this happens
> sequentially, when you reload it's the opposite.
>
>
> Seamless reload makes it possible for haproxy to pass *LISTENING* (but
> not established) sockets from the old to the new process, so that we
> don't loose any new incoming connections on the frontend while
> reloading. Existing connections and transaction however are still
> handled by the old process, until it can close them.
>
>
>
> Lukas
>

Thanks for your explanations : it's clearer for me !

Our goal is to
- have some initial "free" servers in a tcp backend (for example 5 pods)
- when a connection start : one and only one "free" server handle it and it
become "busy" (we do this with maxconn=1)
- add a new "free" servers in the backend, to keep the initial number of
"free" servers

The problem we have with seamless reload: in some case a "busy" server
would received a new connection because after reload current session would
be 0.
And if a do a restart I will lose the "busy" server connection.

I need to find another to do this...
Perhaps with usage of HAProxy runtime API instead of "seamless reload" as
explain in https://www.haproxy.com/blog/dynamic-scaling-for-microservices
-with-runtime-api/ ?

Thanks,
Sébastien

Reply via email to