Algorithms and Hashing (was: Re: Reread of config without restart)

From: Michael Rennt <m.rennt#gmx.net>
Date: Wed, 12 Mar 2008 20:10:01 +0100


Willy Tarreau wrote:
>>
>> But how is persistence solved with source based balancing for example? How
>> is haproxy maintaining the mapping of source ip to the destination server?
>
> There is no IP-based persistence. If you need to use IP address, you use
> address hashing. But generally this is not used since this is a poor and
> unefficient solution to apply persistence.
>
>> Also, how is query hashing realized? Do you put the hash into a cookie?
>
> No, the hash is computed everytime it is needed, and the result is used to
> select the server. But once again, hashing does not provide persistence. In
> fact, it's even an alternative which is often acceptable when persistence
> is not an option. In fact, I'm not sure I really understand your problem.

Ok, I should have tested everything before asking questions. ;)

I see that the server identifier is stored inside the cookies. This is pretty good, as it keeps stickyness even when there's a failover to another equally configured loadbalancer.

Even guessing of the identifier can be prevented by picking a random number as server cookie identifier.

The only question left for now: How is all the hashing and distribution implemented?

I see that the source IP (or whatever other parameter) is hashed and divided by the total weight of all servers. But what if a new server is added? Won't the stickiness be completely different after that, messing up any existing stickiness?

Thanks again for the insight.

Best,

Michael Received on 2008/03/12 20:10

This archive was generated by hypermail 2.2.0 : 2008/03/12 20:15 CET