How fast is Mnesia ?

Hakan Mattsson hakan@REDACTED
Mon Apr 19 10:31:44 CEST 1999


On Fri, 16 Apr 1999, Vladimir Ulogov wrote:

Vladimir> Newbie question #2. Did somebody measure Mnesia efficiency ? What will happens 
Vladimir> if I will need to store 10.000.000 records like this:
Vladimir> NNN.NNN.NNN.NNN NNNNNNNNNN N N N N, where N is some number.
Vladimir> and about 2.000.000 like this
Vladimir> XXXXXXXXXX X X X
Vladimir> 
Vladimir> And I don't know how much like this:
Vladimir> XXX.XXX.XXX.XXX AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Vladimir> where A are some ASCII .
Vladimir> 
Vladimir> Are the Mnesia supports "soft realtime" for the data retrival ? How the tables 
Vladimir> on disk organized ? May be you will suggest to use external database ?

Both disk and ram resident tables in Mnesia are hash tables, utilizing
the linear hashing algorithm. The lookup time should be almost
constant and not dependent of the number of records in the table.

Matching operations in Mnesia normally requires a linear search of the
entire table and for large tables it may lead to unacceptable response
times, if there are no secondandary indecies associated with the table.

If the performance of Mnesia is enough for your application is hard to
say. The best thing is if you can come up with some benchmark that
tries to simulate important database aspects of your application.  Try
to figure out things like data volumes, record sizes, storage types,
access patterns, need for replication etc. etc. and try to implement a
prototype which you can measure.

Since your tables seems to be rather large it is probably worth to
take a look at Mnesia's new support for fragmented tables. The concept
of table fragmentation has been introduced in Mnesia 3.7 in order to
cope with very large tables. The idea is to split a table into several
more manageable fragments. Each fragment is implemented as a first
class Mnesia table and may be replicated, have indecies etc. as any
other table.
 
The dets module which implements the disk resident tables in Mnesia is
currently a bottleneck. But this will improve in some future release,
when the Erlang machine supports segmented binaries and the new
bitsyntax.

Best Regards

	Håkan
--------------------------------------+------------------------------------
Håkan Mattsson,                       | Phone: +46 8 719 9452
Computer Science Laboratory           | E-mail: hakan@REDACTED
Ericsson Network Core Products        | http://www.ericsson.se/cslab/~hakan
Box 1505, SE-126 25 Stockholm, Sweden |





More information about the erlang-questions mailing list