I wonder that connection lost occur or not (seamless, graceful or not)
- when a existing server disappears at a A record from DNS discovery
- when a new server appears at a A record from DNS discovery
I tested them found that there is no connection lost.
But I still wonder it’s really seamless and how it works.
However it is hard to find their answer at document HAProxy version 2.5-dev0 - Configuration Manual. It looks there is no answer about below questions, at the document.
When a existing server disappears or a new server appears at a A record from DNS discovery, HAProxy process reloads its configure?
If it’s not, HAProxy process just modify its ip from a A record, like
echo "set server address" | socat stdio /var/run/hapee-lb.sock? If then,
set server address is always seamless?
- DNS discovery does not use reloads.
- Yes, that’s a good comparison, the DNS discovery updates the server similarly to how a
set server address would update the IP address.
The important thing is: the list of configured servers in a backend is only used for new connections, established connections (or in HTTP mode in flight transactions) are never interrupted, because the routing decision is only made once.
Thank you so much again.
Then although the list of configured servers are updated through
set server address, established connections at a server on outdated backend can close gracefully because they are never interrupted.
Is it correct?
There are differences between HTTP mode (this applies to a HTTP transaction, since there is no 1:1 connection relationships) and TCP mode (this applies to an actual connection - since there is a 1:1 releationship between a connection on the frontend and a connection on the backend), but the point is that the client will not be see anything surprising, only you use “stop/restart” commands (killing haproxy) or use something like
shutdown session on the admin socket.
I see. I appreciate your reply!
- although there is difference of 1:1 connection in HTTP mode and TCP mode, connections are not lost at Two modes when DNS remove a server in A record. is it correct?
- You mean at HTTP mode, each http connection is handled by
http-reuse connection pool and there is no 1:1 connection relations?
- Could you explain the words
only you use “stop/restart” commands (killing haproxy) or use something like shutdown session
on the admin socket.? It mean the client only notice when the haproxy stop/restart or shutdown session?
No client will never notice anything, everything is gracefully handled in a reload or DNS update situation. Only if you stop, restart or shutdown a session manually on the admin socket will the client be disconnected and the in flight data interrupted.
I understand. Thanks for your detailed explanation!