views:

133

answers:

4

I need to study about load-balancers, such as Network Load Balancing, Linux Virtual Server, HAProxy,...There're somethings 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?

Thank you very much for your help.

+2  A: 

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.

Jack Marchetti
I wanted to know about algorithms, that why I asked it here ^^
Vimvq1987
+1, least connections with a keep alive that is cached at a sensible TTL is also what I use. I've never seen round robin not end up with 'favorites' unless there's over 50 or so nodes involved.
Tim Post
@Vimvq1987 - true, but Systems Admins know more about the hardware than programmers due - at least typically. If you want to know how these algorithms are written, then I have no idea ha
Jack Marchetti
I have to study about software-based load-balancers, then I want to describe these algorithms in my thesis. I think programmers here will have well-knowledge about them :).
Vimvq1987
+3  A: 

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

Eric Eijkelenboom
really helpful, thank you :D
Vimvq1987
+1  A: 

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

Austin Salonen
can you give me a link that this method is really used? :D.
Vimvq1987
thank you for the link. Very informative. +1 vote
Vimvq1987
+1  A: 

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.
pnt