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
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
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-questio...@erlang.org
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....@erlang-solutions.com>
To: Pablo Platt <pablo...@yahoo.com>
Cc: erlang-q...@erlang.org
Sent: Tue, October 26, 2010 5:31:24 PM
Subject: Re: [erlang-questions] How does gproc register global names?
> Why doesn't mnesia have a 'light weight' transaction that works like gproc?
Mnesia has a slightly different charter, ensuring consistent persistency.
> When a new leader is elected, how does other nodes knows which names it doesn't know about?
In the Mod:elected() callback, the newly elected leader can
pass data to the others, which they receive in Mod:surrender().
> 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.
True, but my idea was that OTP integrate gproc and make gen.erl
aware of gproc-registered names. :)
> Is it possible to count all registered processes without using a counter?
It would be possible if the function gproc:pattern/2 were exported, or
a function gproc:select_count/2 were added, similar to select/2 et all,
which are already there.
> Is it possible to page thorough all registered processes?
Yes, with either QLC (using gproc:table/1) or using gproc:select/3 (using
the Limit argument to fetch a give number of objects at a time.
BR,
Ulf W
>
> Thanks
Why doesn't OTP integrate gproc?
It is already used and tested by several people.
The code and api are very good.
Can someone from the Erlang team pick up the glove?
________________________________
From: Ulf Wiger <ulf....@erlang-solutions.com>
To: Pablo Platt <pablo...@yahoo.com>
Cc: erlang-q...@erlang.org
Sent: Tue, October 26, 2010 7:27:45 PM
________________________________
From: Ulf Wiger <ulf....@erlang-solutions.com>
To: Pablo Platt <pablo...@yahoo.com>
Cc: erlang-q...@erlang.org
Sent: Tue, October 26, 2010 7:27:45 PM