<div>Thanks ,Paul. I decide to replace the mnesia_frag_hash with my own hash module .With this customized hash module,I hope I can explicitly pass a fragment number to make the fragment splited.</div>
<div>I decide to use a mnesia table or other persitent-able data structure in erlang which can globally seen by all nodes to store the mapping relations between key value range and fragment(Eg. [1..999]-> frag 1,[1000-1999]->frag2), so when I need to split a specifed fragment ,I can rejust the mapping relation table.</div>
<div> </div>
<div>Here's my plan,any suggestions are welcome.<br><br> </div>
<div><span class="gmail_quote">2008/6/19, Paul Mineiro <<a href="mailto:paul-trapexit@mineiro.com">paul-trapexit@mineiro.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Re: picking what gets split, not with the default frag_hash. You can see<br>what it's doing in mnesia_frag_hash.erl ... it basically splits the<br>
fragments in order. This means that unless there is a power-of-two number<br>of fragments they will be of different magnitudes. You could leverage<br>that for your load balancing by placing bigger fragments on less noded<br>
nodes, etc. In fact, maybe this is why you are seeing<br>an uneven distribution to begin with?<br><br>-- p<br><br>p.z. If you are feeling your wheaties, you can make your own frag hash,<br>and specify the module in the frag_properties when you create the table.<br>
<br><a href="http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#5.3">http://www.erlang.org/doc/apps/mnesia/Mnesia_chap5.html#5.3</a><br><br>Don't be tempted to just use phash2 or something like that; in order to go<br>
from N fragments to M fragments you have to pass through all the<br>intermediate stages N + 1, ..., M - 1, M ; you do not want to rehash all<br>the data in all the buckets at each step.<br><br>On Thu, 19 Jun 2008, devdoer bird wrote:<br>
<br>> Thanks.<br>><br>> Thant means ,I need fragment table many times not for load balance but for<br>> decreasing one specific node's (the node is not as powerful as others )<br>> load.<br>><br>> Eg. Node A has 2 fragments,Node B has 2 fragments. Each fragment has equal<br>
> records(say 100 records each fragment).<br>><br>> Now the Node B is heavily loaded.If I adding one or two fragments in Node<br>> A , the load of Node B won't be<br>><br>> decreased ,for the records from Node A will be splited and moved to the new<br>
> fragments,the records on Node A is 50+50+50+50=200 ,the total number of<br>> Node B's record is still 200.<br>><br>> In order to decreas the load on Node B,I have to calcaulate carefully how<br>> many new fragments should be added.<br>
><br>> If there's a way for mnesia to specify which node's fragment should be<br>> splited when addin a new fragment,the problems above will be solved.Take the<br>> example above ,when adding a new fragment,I can tell mnesia to split Node<br>
> B's fragment.<br>><br>> 2008/6/19, Scott Lystig Fritchie <<a href="mailto:fritchie@snookles.com">fritchie@snookles.com</a>>:<br>> ><br>> > devdoer bird <<a href="mailto:devdoer2@gmail.com">devdoer2@gmail.com</a>> wrote:<br>
> ><br>> > dd> I spilit one mnesia table into 3 fragments which distributed on 3<br>> > dd> machines named A,B and C,but now the the machine "A" is very busy,<br>> ><br>> > dd> so I decide split the fragment on the machine "A" into small<br>
> > dd> fragments.Does mnesia support this?<br>> ><br>> > No, that isn't possible with Mnesia, not as you wish/state above.<br>> ><br>> > If you have a table 'tab' split into fragments 'tab', 'tab_frag2', and<br>
> > 'tab_frag3', you can add more fragments: 'tab_frag4', 'tab_frag5', etc.<br>> > You can choose to put only 1 fragment on node A, 4 fragments on node B,<br>> > and 4 fragments on node C. Assuming that access to the table is evenly<br>
> > distributed over all fragments, then node A should be getting only 1/9<br>> > of the load, and B & C will get 4/9 of the load.<br>> ><br>> > -Scott<br>> ><br>><br><br>In an artificial world, only extremists live naturally.<br>
<br> -- Paul Graham<br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>