[erlang-questions] Support for newcomers and the popularity of Erlang

Ulf Wiger <>
Wed Mar 21 07:33:22 CET 2012

On 21 Mar 2012, at 02:38, Wojciech Knapik wrote:

> On Mon, Mar 19, 2012 at 05:38:37PM +0100, Ulf Wiger wrote:
>> I much prefer to have a slightly more strict setup, where you e.g.
>> designate one or two "master" machines that keep a persistent copy of
>> the database. The other machines can start up with the env variable:
>> extra_db_nodes : MasterNodes, and access the database without even
>> having their own copy.
> Let's assume for a moment, that full replication is indeed unnecessary.
> We still want to run identical nodes. Or at least the static code
> delivered to all nodes should be the same and runtime decisions should
> designate a master node. That is not trivial. Would we have to
> "manually" implement an election algorithm, or are there any Erlang
> mechanisms that would make this simpler ? If "manual" is the answer,
> then would you suggest any specific algorithm ?

A simple way to create a critical section is to use global:trans


In this case, what you really need to ensure that the initial schema is created
only once, on one node, and the other nodes attach themselves to it.

> From what everyone here is saying, full mnesia replication will give us
> fault tolerance, but at a severe cost to scalability and performance.

Well, I don't know about severe… :)

In many ways, mnesia is one of the speediest databases you can find 
for Erlang applications. In terms of scalability, the practical limits for a 
fully replicated mnesia database seem to be somewhere around 10 nodes,
at which point it becomes quite problematic. But some very performant systems
have been written on top of mnesia.

You can do things like sharing in mnesia, and you can come up with various
different ways to distribute your data. But if your access patterns are simple
key-value storage patterns without need for transactions, you may be better
off going with e.g. riak. Riak, on the other hand, doesn't scale *down* as well
as mnesia, and generally wants to run in a node of its own. TANSTAAFL. ;-)

Ulf W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120321/d8cd50d7/attachment.html>

More information about the erlang-questions mailing list