[erlang-questions] How would you architecture a ...

Ulf Wiger <>
Mon May 11 08:49:04 CEST 2009

Rapsey wrote:
> What are you planning on storing with mnesia? I would be very careful 
> about it, because it's not all roses. First of all mnesia is very 
> inflexible if you wish to change your data schema, pretty damn slow if 
> you use transactions and I've had situations where I lost the database 
> completely. Mnesia is very unsuitable as a website DB.
> One of the biggest design mistakes I made a 1.5 years ago, for the 
> server I am still developing is relying too heavily on mnesia. When 
> you're starting out in Erlang, mnesia seems great, but with time you 
> realise that it's way more truble than it's worth.

Hmmm, perhaps you should consider the possibility that your
experience is not entirely representative? There are several
24/7 systems that rely heavily on mnesia, and have a fine
service record of many years.

Regarding transaction performance, I recall a benchmark (unfortunately
not released to the public) where a number of proprietary databases
were compared to the best off-the-shelf products. Mnesia tied with
Clustra on transaction performance and scalability, outperforming
all other commercially available DBMSs*, and beating the lot on
response times. Now, this was a subscriber database cluster
benchmark, but it did suprise many people who had written off
mnesia as impossibly slow.

* NDB was the clear winner on transaction performance. It later
became commercially available as MySQL Cluster.

If you compare mnesia transactions to not running transactions,
it's going to be very slow, but that's not really fair, is it?

In what ways did you find mnesia inflexible when changing the
data schema? I can think of one thing: it doesn't handle multiple
concurrent versions of a table definition (TimesTen would do that).
Otherwise, you can change a table definition in a running system,
with or without transforming the data at the same time, change
the replication scheme, move tables between nodes, add or remove
table fragments, add or remove schema nodes and of course create
and delete tables - all without stopping the system.

I'm sure there are issues worth pointing out, but "very inflexible"?

Ulf W
Ulf Wiger
CTO, Erlang Training & Consulting Ltd

More information about the erlang-questions mailing list