[erlang-questions] Support for newcomers and the popularity of Erlang
Wojciech Knapik
wmknapik@REDACTED
Fri Mar 30 10:44:07 CEST 2012
On Wed, Mar 21, 2012 at 07:33:22AM +0100, Ulf Wiger wrote:
> > 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
>
> http://www.erlang.org/doc/man/global.html#trans-2
>
> 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.
Thanks, that was a great hint! I'm now using global:trans to decide who
will initiate the database.
I have one more question though. I need replicating disc_copies, not
ram_copies, so I need to create_schema(ListOfNodes). But what if a node
wants to join in later ? Is it possible to intiate replicating the
schema table from the node that joins in ?
Also, how can I check if the node is already set for replicating before
starting mnesia ? I hear nodes with disc_copies will "remember" their
replication settings when you start mnesia, but the schema
manipulations, if necessary, need to be done before calling
mnesia:start()...
> > 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.
We decided to go with 10 replicating nodes and the remaining ones will
just start with extra_db_nodes. If any of the 10 goes down, we'll make
one of the others start replicating.
WK
More information about the erlang-questions
mailing list