<div dir="ltr"><div>On Mon, Mar 14, 2016 at 1:54 PM Roberto Ostinelli <<a href="mailto:roberto@widetag.com" target="_blank">roberto@widetag.com</a>> wrote:<br></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 14, 2016 at 12:47 PM, Dan Gudmundsson <span dir="ltr"><<a href="mailto:dangud@gmail.com" target="_blank">dangud@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Try using mnesia:write instead of mnesia:dirty_write inside your fun.</div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>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.</div></div></div></div></blockquote><div> </div></div></div><div dir="ltr"><div class="gmail_quote"><div>dirty_write does not care if you use async_dirty, sync_dirty or apply fun directly.<br></div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>However, the findings still persist: the more nodes you add, the slower the writing to mnesia is, even when using async_dirty.</div><div><br></div></div></div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote"><div>I don't see the problem with that, you run more code, and send more messages when you have more nodes. </div><div>When running with one node, you only use the local node with no distribution at all, with several nodes you might block on send because<br></div><div>tcp buffers are full and so on.</div><div><br></div><div>You should use mnesia:write and compare async_ vs sync_.</div><div><br></div><div>/Dan</div><div> <br></div></div></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>Any other ideas?</div><div><br></div><div>Best,</div><div>r.</div><div><br></div><div><br></div><div><br></div><div>%%%%% RESULTS %%%%%</div><div><br></div><div><span style="font-family:monospace,monospace">write_bench(Count) -></span><br></div><div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> F = fun(N) -></font></div><div><font face="monospace, monospace"> mnesia:activity(sync_dirty, fun() -></font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> mnesia:write(#test_table{key = N, value = N})</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> end)</font></div><div><font face="monospace, monospace"> end,</font></div><div><font face="monospace, monospace"> lists:foreach(F, lists:seq(1, Count)).</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> mnesia_test:write(['<a href="mailto:1@127.0.0.1" target="_blank">1@127.0.0.1</a>']).</font></div><div><font face="monospace, monospace">Written in 1.756049 sec, at a rate of 284730.095800288/sec</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> mnesia_test:write(['<a href="mailto:1@127.0.0.1" target="_blank">1@127.0.0.1</a>','<a href="mailto:2@127.0.0.1" target="_blank">2@127.0.0.1</a>']).</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace">Written in 37.094925 sec, at a rate of <b>13478</b>.932765061529/sec</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">write_bench(Count) -></font></div><div><font face="monospace, monospace"> F = fun(N) -></font></div><div><font face="monospace, monospace"> mnesia:activity(async_dirty, fun() -></font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> mnesia:write(#test_table{key = N, value = N})</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> end)</font></div><div><font face="monospace, monospace"> end,</font></div><div><font face="monospace, monospace"> lists:foreach(F, lists:seq(1, Count)).</font></div><div><font face="monospace, monospace"><br></font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"> mnesia_test:write(['<a href="mailto:1@127.0.0.1" target="_blank">1@127.0.0.1</a>']).</font></div><div><font face="monospace, monospace">Written in 1.914213 sec, at a rate of 261203.9517023445/sec</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> mnesia_test:write(['<a href="mailto:1@127.0.0.1" target="_blank">1@127.0.0.1</a>','<a href="mailto:2@127.0.0.1" target="_blank">2@127.0.0.1</a>']).</font></div></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><font face="monospace, monospace">Written in 3.402219 sec, at a rate of 146962.9086193452/sec</font></div></div><div><br></div><div><br></div><div><br></div><div> </div></div></div></div>
</blockquote></div></div></div>