This post has NOT been accepted by the mailing list yet.
Building from this question ( http://stackoverflow.com/q/5339329/431620 ), imagine an application with N Erlang Web Servers, and N/2 Mnesia Database Nodes. The set up is such that the Web Servers, each, runs on its own hardware server (say HP DL385), and each Mnesia Instance, runs on its own hardware Server as well.
Web Servers make rpc:call/4 calls to the back end (the Mnesia DB Servers). The Data is all replicated across all the Mnesia instances. Now, you want to have the calls being made to the Database servers, MULTIPLEXED, more precisely ( by TIME), on each Web Server, so that some kind of LOAD BALANCING is attained.
If Web Server A makes a connection to Mnesia Instance 3, it cannot make the next connection to the same Instance. All Database Nodes need to be kept busy and not having any one of them idle while the others are working. The Load balancing Algorithm should not be random, but should be aimed at balancing the load on the Database Servers.
Qn 1: Come up with your load balancing strategy, in such a situation. Also, please show with some sample illustrative code, how you would implement this strategy.
Qn 2: If a Mnesia Instance goes down, how would your load balance Algorithm adapt to the changes in the cluster ?
Qn 3: Is there any Erlang library aimed at load balancing of Erlang Servers working within the same system, and calling each other via rpc:call/4 ?