Mnesia: Load sharing and redundancy

Hakan Mattsson <>
Tue Mar 9 14:13:33 CET 2004


Carlos> Hi, I want to implement load sharing without loosing redundancy.
Carlos> 
Carlos> Can anyone give me an example on how to fragment and replicate a
Carlos> Mnesia database to have this implemented?  I mean referencing, how
Carlos> many nodes, machines and fragments. And the distribution of them.
Carlos> 
Carlos> For example I figure that  this could be a good solution, isn't it?
Carlos> 
Carlos> Two nodes in one machine and two other nodes in another machine. Nodes
Carlos> A and B in machine M1, nodes C and D in machine M2.
Carlos> 
Carlos> All DB tables fragmented in two fragments one fragment resident at
Carlos> node A, and one fragment at node C (then we use M1 and M2 machines to
Carlos> have load sharing).
Carlos> 
Carlos> This implementation replicated as follows: fragments at node A
Carlos> replicated at node D, and fragments at node C replicated at node B
Carlos> (then we have cross replicas - M1 fragments with M2 ones).  See
Carlos> attachment for representation.
Carlos> 
Carlos> I would apreciate your answer very much, to have my DB implemented as
Carlos> soon as possible.
Carlos> 
Carlos> Thanks, Carlos E. Silva.-

In order to keep things simple, I would suggest that you:

- Only have one node per machine. Why have you choosen to have two
  nodes per machine?

- Avoid addition of new fragments to existing tables while system is
  in full operation. Addition of new fragments is quite expensive as
  it will imply existing records to be rehashed and moved between
  fragments. A plain move of a fragment is cheaper.

- Avoid huge fragments. If you expect large data volumes you should
  distribute it over more fragments than you would do for small data
  volumes. This would give you a better precision in your load
  balancing and lesser disturbance when you move fragments between
  nodes.

- Try to estimate the maximum number of nodes (machines) that you
  that you ever will use in your system. The number of initial
  fragments should always be more than the maximum number of nodes,
  perhaps a factor 5 or 10 more.

- Take a look at the mnesia/examples/bench example.

/Håkan

PS.
  If your maximum configuration only is two nodes there are no point
  in using fragmented tables at all, for the purpose of load balancing.

---
Håkan Mattsson
Ericsson
High Availability Software, DBMS Internals
http://www.erlang.org/~hakan/


This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the erlang-questions mailing list