[erlang-questions] "Erlang plus BDB: Disrupting the Conventional Web Wisdom"

Chris Newcombe <>
Thu Oct 11 21:44:17 CEST 2007


> For that matter, what about mnesia? It seems pretty self-serving for her to say
> "The only thing missing from Erlang is large-scale persistent storage". Mnesia
> scales well and is used in high-demand production environments, right?

Mnesia is clearly a fine piece of software, but it was designed for
certain use-cases, and accordingly has different trade-offs when
compared to Berkeley DB.

e.g. Berkeley DB supports 256 TB data per machine (max record size is
4GB) -- the mnesia limit is currently much lower than that (4 GB per
node in 32-bit Erlang?).   I suspect that Margo was refering to this
point (the 'large scale' comment).

Other notable differences:

Mnesia and BDB have different recovery models.  I've read that if an
mnesia/dets node loses power during a disk-write it can reportedly
take a very long time to repair the file (hours?).  Berkeley DB with
transactions can usually recover very quickly (depends on the
configured frequency of checkpoints and rate/size of new transactions,
just like any conventional database with write-ahead logging).

The concurrency models are different: Berkeley DB has page-level
locking, not row-level locking, but concurrency is on a per-OS thread
basis (EDTK adds private configurable threadpools to avoid blocking
the Erlang scheduler threads when using BDB).  Which model is better
depends on use-cases.

The replication models are different. Berkeley DB offers a
single-master, multiple-replica system with fast failover.  It can
handle partitioned networks, assuming that there is still a connected
majority of nodes.  I've read several reports that mnesia doesn't
handle network partitioning very well at all (to the point where it is
best to disable auto-reconnection of Erlang nodes that are running
mnesia), presumably because it was designed for telecoms switches
where network partitioning is relatively rare.

Chris



More information about the erlang-questions mailing list