Hello Sébastien,

On Mon, 15 Oct 2018 at 16:40, Sébastien Kurtzemann <s...@seize.tv> 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

Reply via email to