[erlang-questions] Mnesia Reads and Writes

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Oct 19 13:26:12 CEST 2012


On Jul 23, 2012, at 12:53 AM, Genti Bogu <gentibogu@REDACTED> wrote:

> I would be glad if somebody could help me understand some basic stuff about Mnesia IO operations.
> Thanks,

Mnesia is in general optimistic about locking. So upon a possible conflict it will retry the transaction. I cannot explain why your read-load is 7 times higher, but I would advise that simple one-record reads are done in
a dirty fashion.

Note that a dirty read is still atomic for the record, but it runs outside the lock manager and is thus much faster. You only need a read transaction when you want a consistent view over multiple queries, and I've found that the places where this is needed is far in between and relatively few. At least for the main usage of mnesia, which is to provide very fast point-query in-memory lookup of a table which is kept in sync over multiple machines.

Essentially any other kind of desired storage property is better served with another system specifically built to store data of large size such that a considerable part of the data must be kept off-line on disk.

Be sure you are evaluating mnesia's performance for a scenario it was built to handle :) Otherwise you will just be sorry later on if your data cannot fit into main memory.

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen




More information about the erlang-questions mailing list