CSC 456 Fall 2013/4a bc

From Expertiza_Wiki
Jump to navigation Jump to search

Load Balancing

Static Vs. Dynamic Techniques

Static Load balancing

Dynamic Load Balancing

Real World applications of Load Balancing

Examples of Load Balancing in action

Server Load balancing pseudocode


server_load_vec_desc = sort_descending(server_load_vec);
server_load_vec_asc = sort_ascending(server_load_vec);
while (server_load_vec_desc[0].deviation > DEVIATION_THRESHOLD) {
  populate_range_load_vector(server_load_vec_desc[0].server_name);
  sort descending range_load_vec;
  i=0;
  while (server_load_vec_desc[0].deviation > DEVIATION_THRESHOLD &&
            i < range_load_vec.size()) {
    if (moving range_load_vec[i] from server_load_vec_desc[0] to server_load_vec_asc[0] reduces deviation) {
       add range_load_vec[i] to balance plan
       partial_deviation = range_load_vec[i].loadestimate * loadavg_per_loadestimate;
       server_load_vec_desc[0].loadavg -= partial_deviation;
       server_load_vec_desc[0].deviation -= partial_deviation;
       server_load_vec_asc[0].loadavg += partial_deviation;
       server_load_vec_asc[0].deviation += partial_deviation;
       server_load_vec_asc = sort_ascending(server_load_vec_asc); 
    }
    i++;
  }
  if (i == range_load_vec.size())
    remove server_load_vec_desc[0] and corresponding entry in server_load_vec_asc  
  server_load_vec_desc = sort_descending(server_load_vec_desc);
}