[erlang-questions] sync gproc table with a slave server

Loïc Hoguin essen@REDACTED
Sat Dec 20 00:03:50 CET 2014


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).

Also look at gen_server:multi_call/2,3,4 and gen_server:abcast/2,3, and 
at equivalents for gen_fsm and others.

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. :-)

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.

On 12/20/2014 12:47 AM, Paul Peregud wrote:
> Pablo, since you have not provided that much information, I'll suggest
> to try to get away with calls to master node's gproc app instance via
> Erlang distribution (erlang:rpc/3). You will avoid a can of worms.
>
> Or you can try gproc global registration. I would suspect dragons in
> that particular area.
>
> On Dec 18, 2014 7:48 PM, "pablo platt" <pablo.platt@REDACTED
> <mailto:pablo.platt@REDACTED>> wrote:
>
>     Hi,
>
>     I'm using gproc to register user sessions.
>     How can I sync the gproc ets table with a slave server?
>     Is gen_leader an overkill when the same server will always be the
>     master and I don't need master election?
>
>     Can the slave be notified for any change in gproc so it will know
>     when a user session added, removed or changed?
>
>     Thanks
>
>     _______________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list