开发者

Algorithms behind load-balancers?

开发者 https://www.devze.com 2022-12-25 03:37 出处:网络
I need to study about load-balancers, suc开发者_如何学Pythonh as Network Load Balancing, Linux Virtual Server, HAProxy, etc. There\'re something under-the-hood I need to know:

I need to study about load-balancers, suc开发者_如何学Pythonh as Network Load Balancing, Linux Virtual Server, HAProxy, etc. There're something under-the-hood I need to know:

  • What algorithms/technologies are used in these load-balancers? Which is the most popular? most effective?

I expect that these algorithms/technologies will not be too complicated. Are there some resources written about them?


Load balancing in Apache, for example, is taken care of by the module called mod_proxy_balancer. This module supports 3 load balancing algorithms:

  • Request counting
  • Weighted traffic counting
  • Pending request counting

For more details, take a look here: mod_proxy_balancer


Not sure if this belongs on serverfault or not, but some load balancing techniques are:

  • Round Robin
  • Least Connections

I used least connections. It just made the most sense to send the person to the machine which had the least amount of load.


In general, load balancing is all about sending new client requests to servers which are the least busy. Based on the application running, assign a 'busy factor' to each server: basically a number reflecting one/several points of interest for your load balancing algorithm (connected clients, cpu/mem usage, etc.) and then, at runtime, choose the server with the lowest such score. Basically ANY load balancing technique is based on something like this:

  1. Round robin does not implement a 'busy score' per se, but assigns each consecutive request to the next server in a circular queue.
  2. Least connections has its score = number_of_open_connections to the server. Obviously, a server with fewer connections is a better choice.
  3. Random assignment is a special case - you make an uninformed decision about the server's load, but assume that the function has a statistically even distribution.


In addition to those already mentioned, a simple random assignment can be a good enough algorithm for load balancing, especially with a large number of servers.

Here's one link from Oracle: http://download-llnw.oracle.com/docs/cd/E11035_01/wls100/cluster/load_balancing.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号