[erlang-questions] mnesia async vs sync
Roberto Ostinelli
roberto@REDACTED
Mon Mar 14 13:54:37 CET 2016
On Mon, Mar 14, 2016 at 12:47 PM, Dan Gudmundsson <dangud@REDACTED> wrote:
> Try using mnesia:write instead of mnesia:dirty_write inside your fun.
>
Making this change makes sync_dirty much slower when there are more than
just one node. So, this clarifies that probably using dirty_write with
sync_dirty falls back to async_dirty anyway.
However, the findings still persist: the more nodes you add, the slower the
writing to mnesia is, even when using async_dirty.
Any other ideas?
Best,
r.
%%%%% RESULTS %%%%%
write_bench(Count) ->
F = fun(N) ->
mnesia:activity(sync_dirty, fun() ->
mnesia:write(#test_table{key = N, value = N})
end)
end,
lists:foreach(F, lists:seq(1, Count)).
mnesia_test:write(['1@REDACTED']).
Written in 1.756049 sec, at a rate of 284730.095800288/sec
mnesia_test:write(['1@REDACTED','2@REDACTED']).
Written in 37.094925 sec, at a rate of *13478*.932765061529/sec
write_bench(Count) ->
F = fun(N) ->
mnesia:activity(async_dirty, fun() ->
mnesia:write(#test_table{key = N, value = N})
end)
end,
lists:foreach(F, lists:seq(1, Count)).
mnesia_test:write(['1@REDACTED']).
Written in 1.914213 sec, at a rate of 261203.9517023445/sec
mnesia_test:write(['1@REDACTED','2@REDACTED']).
Written in 3.402219 sec, at a rate of 146962.9086193452/sec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160314/c1770929/attachment.htm>
More information about the erlang-questions
mailing list