<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 14, 2016 at 4:27 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"><span class=""><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: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"><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></span><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></blockquote><div><br></div><div>Paraphrasing what I've said, so yes. :)</div><div> </div><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"><div dir="ltr"><div class="gmail_quote"><div></div></div></div><span class=""><div dir="ltr"><div class="gmail_quote"><div> </div><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"><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></span><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></div></div></blockquote><div><br></div><div>Sure, but that's not what is written in the docs. Here they are again:</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div>"By passing the same "fun" as an argument to the function mnesia:sync_dirty(Fun [, Args]), it is performed in almost the same context as the function mnesia:async_dirty/1,2. The difference is that the operations are performed synchronously. The caller waits for the updates to be performed on all active replicas."</div></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><div><br></div><div>and</div><div><br></div></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div><div>"The functions wait for the operation to be performed on one node but not the others. If the table resides locally, no waiting occurs."</div></div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div> </div><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"><div dir="ltr"><div class="gmail_quote"><div>You should use mnesia:write and compare async_ vs sync_.</div></div></div></div></blockquote><div> </div><div>Which is what I did in my previous email. :)</div><div>The findings are that async_dirty also has a significant performance loss.</div><div><br></div><div>Best,</div><div>r.</div><div><br></div></div></div></div>