[lvs-users] DR-mode realserver selection via consistent hashing on request URL?
horms at verge.net.au
Fri Nov 27 12:23:11 GMT 2009
On Tue, Nov 17, 2009 at 02:37:37PM -0800, Josh Adams wrote:
> On Tue, Nov 17, 2009 at 13:34, Joseph Mack NA3T <jmack at wm7d.net> wrote:
> > -dh maps on urls, not IPs (it was developed for squids).
> > The urls are divided evenly over the realservers. Otherwise
> > I don't know the answer to your question.
> Ok, thanks for the clarification. I expected dh to be based on ip
> because of what I saw in the source in my kernel's ip_vs_dh.c
> 18 /*
> 19 * The dh algorithm is to select server by the hash key of
> destination IP
> 20 * address. The pseudo code is as follows:
> 21 *
> 22 * n <- servernode[dest_ip];
> 23 * if (n is dead) OR
> 24 * (n is overloaded) OR (n.weight <= 0) then
> 25 * return NULL;
> 26 *
> 27 * return n;
> 28 *
> 29 * Notes that servernode is a 256-bucket hash table that maps the hash
> 30 * index derived from packet destination IP address to the
> current server
> 31 * array. If the dh scheduler is used in cache cluster, it is good to
> 32 * combine it with cache_bypass feature. When the statically assigned
> 33 * server is dead or overloaded, the load balancer can bypass the cache
> 34 * server and send requests to the original server directly.
> 35 *
> 36 */
> Has this been changed to url-based hashing in a later version of
> ip_vs_dh.c or am I just looking in the wrong place (ie, is there
> another dh scheduler somewhere else)? The consistent hashing-like
> redistribution of down realservers' objects question still applies,
> but I guess I can find that out by reading the source of the url-based
> dh scheduler.
your assumption is correct. The dh scheduler for IPVS works on addresses
not URLs. IPVS works at L4, does not have access to higher-level
information such as URLs and thus can't use such information in
The kind of scheduling you are after generally takes place
at layer 7. I imagine that squid can do such things. Ultramonkey-L7
also has this kind of facility.
More information about the lvs-users