Re: Question about using "force-persist"

From: Willy Tarreau <w#1wt.eu>
Date: Tue, 22 Mar 2011 20:54:30 +0100


On Tue, Mar 22, 2011 at 12:51:36PM -0500, Shaw, Christopher wrote:
> I very much appreciate all of your assistance with this, but I'm still
> not sure I entirely understand why this is failing. The persistence
> works for me, using the mstshash (username) cookie, as long as the
> server with my running session is alive and well in the farm -- even
> when I reconnect from a different IP address.

This is not persistence, this is load balancing. Persistence is about how to bypass load balancing using some information that make you certain of using a more appropriate server than if you did load balancing.

In RDP, there are two cookies :

No persistence is performed on mstshash. It's just that we perform load balancing based on it. It is hashed, divided by the number of servers and points to a server. As long as the farm size remains unchanged, the same username will go to the same server. But if you change the farm size (take servers down, etc...) then the divide does not result in the same modulo, possibly leading to a different server.

Persistence is possible on the msts cookie. This one contains the server's IP address. That means that when the client reconnects, it reminds haproxy what server it was running on. Haproxy looks in its server list to find the one with the same IP and directs the request there. That way, even if this servers' weights change, the users will still find their assigned servers. And if a server is taken down and option persist is enabled, persistent connections will still be attempted to them.

Balancing on the mstshash can be seen as the "poor man's persistence". A better solution is to balance with leastconn and stick on msts.

Hoping this clarifies the things a little bit, Willy Received on 2011/03/22 20:54

This archive was generated by hypermail 2.2.0 : 2011/03/22 21:00 CET