[erlang-questions] How does gproc register global names?
Pablo Platt
pablo.platt@REDACTED
Tue Oct 26 18:49:26 CEST 2010
Why doesn't mnesia have a 'light weight' transaction that works like gproc?
When a new leader is elected, how does other nodes knows which names it doesn't
know about?
I'm using gproc to register gen_server processes.
It might be useful to have gproc:cast and gproc:call that use gen_server:cast
and gen_server:call in addition to gproc:send.
Is it possible to count all registered processes without using a counter?
Is it possible to page thorough all registered processes?
Thanks
________________________________
From: Ulf Wiger <ulf.wiger@REDACTED>
To: Pablo Platt <pablo.platt@REDACTED>
Cc: erlang-questions@REDACTED
Sent: Tue, October 26, 2010 5:31:24 PM
Subject: Re: [erlang-questions] How does gproc register global names?
It is correct that gproc uses gen_leader.
All registration reguests are passed on to the leader process,
and it broadcasts the results to the other candidates & workers.
Monitoring of registered processes is done by the local gproc
instance.
When a new leader is elected, it sends its list of registered names
to the others; if they happen to have names that the new leader
doesn't know about, they will send them to the new leader.
This is not terribly unlike how global does things, although it uses
a multicall mechanism to handle atomicity. In measurements that
I've made, the gproc method is much more efficient.
OTOH, global has facilities to handle partitioned networks. Gproc
doesn't... yet.
Using mnesia would not give better consistency, unless transactions
are used - but that would kill performance. And there are no persistency
reasons to use it either. Gproc uses ets tables, which are rigged to survive
even if the gproc process dies; the restarted gproc scans the table and
sets new monitors.
BR,
Ulf W
On 26 Oct 2010, at 15:48, Pablo Platt wrote:
> Hi
>
> I'm using gproc to register local names and properties.
> I've read that gen_leader is needed to use gproc in the global scope.
>
> How does the data get synced across all nodes?
> Why isn't mnesia being used for that?
> How do you solve race conditions and failures?
>
> Thanks
>
>
>
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
More information about the erlang-questions
mailing list