Hi all,

This week was more about reading than writing code.My work was related with
load balancing.I was able to implement several simple but fast, non-locking
load balancing methods.
In some of the load balancing algorithms I may need to use locks.

Currently when I receive client connection, I make the following steps:
0. Regular expression match is performed on the request URI until a match
is found. A list of slave servers and a balancing algorithm is determined
based on that match.
1. A balancing function is invoked and a list of slave servers is passed to
it. There is one function for each balancing algorithm.
2. The balancing function determines which slave server to use (this is
algorithm-dependent).
3. A new socket is created and connected to the chosen slave server. The
socket is set to non-blocking mode. If a connection can not be established,
step 2 is repeated. If all the slave servers fail, an error is returned.

About the load balancing:
As I said before, I was able to make a couple of simple load balancing
functions, that should be fast.
Algorithms:
int hash
    A server is chosen, based on a simple hash function. The hash function
can be based on socket number, current time, etc. This algorithm has very
little overhead, because is just making modular modulo of the variable by
max hosts .
Naïve (lockless) a.k.a Round Robin
    For each consequent connection, the next slave server is chosen. No
locking is done to avoid performance penalties. This algorithm has very
little overhead.
Naïve (locking) a.k.a. Round Robin
    For each consequent connection, the next slave server is chosen.
Locking is done to assure more equal load on the slave servers.

My plans for next week are to make more tests and better load balancing,
also to start making some high availability features in the plugin.

Git Hub: https://github.com/nikolanikov/monkey
Blog url: http://nikolanikov.wordpress.com/

Regards,
Nikola Nikov
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to