Reputation: 119
I have a deployment with 2 pods of a web application. The web application requires a logon and maintains a session. After i kill the first pod i am automatically redirected to the logon page of the second pod, but when the first pod is loaded again i am redirected back to it. I have tried to use the HAproxy "balance source" algorithm and coockies. Any idea why doesn't it stay with the second pod?
Upvotes: 2
Views: 1745
Reputation: 178966
balance source
uses a hashing algorithm that changes the workload distribution every time the number of available backends changes, because that is what it's designed to do. If you had more than 2 backends, you would also find that taking down any one backend will cause some traffic that wasn't even hitting the impacted backend to shift to another, because of this redistribution.
If the hash result changes due to the number of running servers changing, many clients will be directed to a different server.
http://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4-balance
For an explanation of why you didn't see the expected behavior when using cookies instead of balance source
, we'd need to see your configuration.
Upvotes: 1