I spent this week working on different load balancers. Here is the actual
list and short description for each of them:
Naïve
Simple, non-fair load balancer with almost no overhead.
Connects to the first alive server, starting from server.
First-Alive
Simple, non-fair load balancer with almost no overhead.
Connects to the first alive server, starting from 0.
Lockless Round Robin
Simple load balancer with almost no overhead. Race conditions are
possible under heavy load, but they will just lead to unfair sharing of the
load.
Each consecutive call connects to the next available server. Race
conditions can occur since no locking is performed.
Locking Round Robin
Simple load balancer. Race conditions are prevented with mutexes. This
adds significant overhead under heavy load.
Each consecutive call connects to the next available server. Race
conditions are prevented at the expense of performance.
Least connections
Ensures equal load in most use cases. All servers are traversed to find
the one with least connections.
Connects to the server with the least number of connections. Ensures
equal load in most use cases but adds significant overhead.
Weighted Round Robin can be done by entering the same server several times
in the Round Robin blancer section. Example:
[PROXY_ENTRY]
ServerList 127.0.0.1:80 127.0.0.1:81 127.0.0.1:80 127.0.0.1:82
127.0.0.1:80 127.0.0.1:81
LoadBalancer RoundRobin
Match ^/.*
This can be read as:
127.0.0.1:80 weight=3
127.0.0.1:81 weight=2
127.0.0.1:82 weight=1
The least connections load balancer is the most sophisticated of all. It
ensures equal load except for some cases where there is a big difference
between different requests and it happened that the heavier ones have all
gone to a single server. The major drawback is that tracking the
connections adds significant overhead.
I worked to improve some of the existing load balancers (to simplify them
and minimize their load).
I started writing code that will keep track of the servers. The idea is
that plugin detects whether a server is down and take appropriate actions.
The plugin can also keep track of the response time of each server and take
that into account in some more sophisticated load balancers.
Next, I'm going to do a lot of tests to make sure that the balancers really
work as expected. I will look for possible improvements (mainly to decrease
memory usage and increase performance).
GitHub repository : https://github.com/nikolanikov/monkey
Blog : http://nikolanikov.wordpress.com/
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey