Difference between revisions of "Source Hashing Scheduling"

From LVSKB
Jump to: navigation, search
m
m
 
Line 20: Line 20:
 
Notes that servernode is a 256-bucket hash table that maps the hash
 
Notes that servernode is a 256-bucket hash table that maps the hash
 
index derived from packet source IP address to the current server
 
index derived from packet source IP address to the current server
array. If the sh scheduler is used in cache cluster, it is good to
+
array.
combine it with cache_bypass feature. When the statically assigned
+
server is dead or overloaded, the load balancer can bypass the cache
+
server and send requests to the original server directly.
+
 
</pre>
 
</pre>
  
  
 
[[Category:Job Scheduling Algorithms]]
 
[[Category:Job Scheduling Algorithms]]

Latest revision as of 15:27, 17 June 2007

The source hashing scheduling algorithm assigns network connections to the servers through looking up a statically assigned hash table by their source IP addresses.

Maybe, it would be nice to put this in the HOWTO, a lot of people, me too, don't understand why SH seems to lose connections. It's not a bug but a misconfiguration due to a lack of documentation. (The manpage of ipvsadm doesn't mention the following)

But, careful, the weight of a realserver with the SH scheduler means the maximum number of connections, multiplied by 2, allowed on this realserver. The meaning of the weight argument is very different in SH and DH than RR, LC and others.

Just read this thread in lvs-users : Persistence vs SH scheduler. Thanks to Martijn Grendelman to pointing this out.

The sh algorithm is to select server by the hash key of source IP
address. The pseudo code is as follows:

      n <- servernode[src_ip];
      if (n is dead) OR
         (n is overloaded, such as n.conns>2*n.weight) then
                return NULL;

      return n;

Notes that servernode is a 256-bucket hash table that maps the hash
index derived from packet source IP address to the current server
array.