we have an haproxy config two nodes and the balance alogrithm as “leastconn”. If we load 10 connections then each backend server end up getting 5 connections. Now we add another node to the backend server list and do “systemctl reload haproxy”. The existing 10 connections remain. But if we make another 5 new front end connections then they are supposed to go to 3rd backend server only. However we see that the first and second backend servers too get connections along with the newly added third backend server.
If we see haproxy logs we see that “total-to-server” counter has become 0 on the earlier existing nodes. Seems across reloads this stat is not persisted. Explored the option https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-load-server-state-from-file. Even after doing
socat /tmp/socket - <<< “show servers state” > /tmp/server_state
before reloading the haproxy service when new connections arrive the “total-to-server” still seems to start all over from 0 for existing servers. I also do not see this stat stored in the “/tmp/server_state” file.
Is there something we are missing here or is it working as expected? Please let know