[erlang-questions] Tuning mnesia for mnesia:dirty_update_counter w/ disc_copies?

Bob Ippolito bob@REDACTED
Sun Jan 7 00:03:13 CET 2007

I started using mnesia recently in one of my applications (running on
R11B-2, FreeBSD) so that the data was persistent in case I had to
restart the server (the distribution features are also interesting,
but not neccessary yet). The application originally used ets, but now
it's using mnesia tables with disc_copies.

My usage pattern is such that my application does almost 100% dirty
reads and writes. The writes are entirely done by
mnesia:dirty_update_counter (with one transactional read+write to
handle the 0 case), and the reads are done with dirty_read. This is
currently all serialized through one process on one node anyway, so I
have no use for the transactional features at the moment.

I only have a few hundred records in the table, but
dirty_update_counter is being called extremely often. So often in fact
that occasionally I get these messages (it also ends up using a lot of

=ERROR REPORT==== 6-Jan-2007::14:43:26 ===
Mnesia(...): ** WARNING ** Mnesia is overloaded: {dump_log,

Is there anything I can tune, or will I have to switch back to
something RAM based (e.g. using ets, but flushing periodically to

For reference, the code looks like this:

track(Tag, Inc) ->
    %% dirty_update_counter is silly
    case mnesia:dirty_update_counter(db, Tag, Inc) of
    X when X == Inc, Inc > 0 ->
        F = fun () ->
            [R] = mnesia:read(db, Tag, write),
    _ ->

fetch(Tag) ->
    case mnesia:dirty_read(db, Tag) of
    [#db{tag=Tag, count=Res}] ->
    [] ->


More information about the erlang-questions mailing list