<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 21 Mar 2012, at 02:38, Wojciech Knapik wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Mon, Mar 19, 2012 at 05:38:37PM +0100, Ulf Wiger wrote:<br><br><blockquote type="cite">I much prefer to have a slightly more strict setup, where you e.g.<br></blockquote><blockquote type="cite">designate one or two "master" machines that keep a persistent copy of<br></blockquote><blockquote type="cite">the database. The other machines can start up with the env variable:<br></blockquote><blockquote type="cite">extra_db_nodes : MasterNodes, and access the database without even<br></blockquote><blockquote type="cite">having their own copy.<br></blockquote><br>Let's assume for a moment, that full replication is indeed unnecessary.<br>We still want to run identical nodes. Or at least the static code<br>delivered to all nodes should be the same and runtime decisions should<br>designate a master node. That is not trivial. Would we have to<br>"manually" implement an election algorithm, or are there any Erlang<br>mechanisms that would make this simpler ? If "manual" is the answer,<br>then would you suggest any specific algorithm ?<br></div></blockquote><div><br></div><div>A simple way to create a critical section is to use global:trans</div><div><br></div><div><a href="http://www.erlang.org/doc/man/global.html#trans-2">http://www.erlang.org/doc/man/global.html#trans-2</a></div><div><br></div><div>In this case, what you really need to ensure that the initial schema is created</div><div>only once, on one node, and the other nodes attach themselves to it.</div><div><br></div><br><blockquote type="cite"><div>From what everyone here is saying, full mnesia replication will give us<br>fault tolerance, but at a severe cost to scalability and performance.<br></div></blockquote><div><br></div><div>Well, I don't know about severe… :)</div><div><br></div><div>In many ways, mnesia is one of the speediest databases you can find </div><div>for Erlang applications. In terms of scalability, the practical limits for a </div><div>fully replicated mnesia database seem to be somewhere around 10 nodes,</div><div>at which point it becomes quite problematic. But some very performant systems</div><div>have been written on top of mnesia.</div><div><br></div><div>You can do things like sharing in mnesia, and you can come up with various</div><div>different ways to distribute your data. But if your access patterns are simple</div><div>key-value storage patterns without need for transactions, you may be better</div><div>off going with e.g. riak. Riak, on the other hand, doesn't scale *down* as well</div><div>as mnesia, and generally wants to run in a node of its own. TANSTAAFL. ;-)</div><div><br></div></div>BR,<div>Ulf W</div></body></html>