<div dir="ltr"><div><div><div><div><div><div><div><div>Paul, my use case is simple. I have a master server that handles user sessions and a slave server that handles a specific app separated from the main session.<br></div>The slave need to know if a user has permission to view or edit app instance.<br></div>gproc local is very nice because it clean names and properties when a process dies.<br><br></div>With mnesia I could use ram only table and have a read-only copy on the slave.<br></div>I can also listen to table events and handle user permissions changes.<br><br></div>Another option is that the slave will make a call to the master when a new user try to access an app instance.<br></div>When a user permission is changed on the master, it will send a message to the slave.<br></div>This is a bit more complicated and in case of a network error, I'll might be in a non consistent state.<br><br></div>If gproc had a simple read only replication (based on mnesia?) and more granular notifications it could solve my use case.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 20, 2014 at 1:03 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Guessing by erlang:rpc/3 you meant to look at the rpc module. This module allows both synchronous and asynchronous calls (the latter is often missed).<br>
<br>
Also look at gen_server:multi_call/2,3,4 and gen_server:abcast/2,3, and at equivalents for gen_fsm and others.<br>
<br>
I have had issues with gproc+gen_leader (if a node crashes, the tables lose sync). Ulf created the locks application that can be used with gproc, not sure if this gproc+locks combination works well though. Been eager to know and tried to get people to test it, as I haven't had the opportunity to try myself. :-)<br>
<br>
A gproc local + multi_call/abcast solution has worked pretty well in my experience, with a small number of servers located right next to each other. This wouldn't work with a large number of servers though.<span class=""><br>
<br>
On 12/20/2014 12:47 AM, Paul Peregud wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Pablo, since you have not provided that much information, I'll suggest<br>
to try to get away with calls to master node's gproc app instance via<br>
Erlang distribution (erlang:rpc/3). You will avoid a can of worms.<br>
<br>
Or you can try gproc global registration. I would suspect dragons in<br>
that particular area.<br>
<br>
On Dec 18, 2014 7:48 PM, "pablo platt" <<a href="mailto:pablo.platt@gmail.com" target="_blank">pablo.platt@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:pablo.platt@gmail.com" target="_blank">pablo.platt@gmail.com</a>><u></u>> wrote:<br>
<br>
    Hi,<br>
<br>
    I'm using gproc to register user sessions.<br>
    How can I sync the gproc ets table with a slave server?<br>
    Is gen_leader an overkill when the same server will always be the<br>
    master and I don't need master election?<br>
<br>
    Can the slave be notified for any change in gproc so it will know<br>
    when a user session added, removed or changed?<br>
<br>
    Thanks<br>
<br>
    ______________________________<u></u>_________________<br>
    erlang-questions mailing list<br></span>
    <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>><br>
    <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><span class=""><br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
<br>
</span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Loïc Hoguin<br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br>
</font></span></blockquote></div><br></div>