Destination Hashing Scheduling

From LVSKB
Jump to: navigation, search

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

The DH scheduling algorithm is to select server by the hash key of destination IP address. The pseudo code is as follows:

      n <- servernode[dest_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 destination IP address to the current server
array.

If the dh scheduler is used in cache cluster, it is good to 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.