[erlang-questions] distributed gproc and gen_leader

Ulf Wiger ulf@REDACTED
Tue Oct 6 12:32:52 CEST 2015


Having written gproc, here are my 2c:

- Gproc can support distributed systems in two ways:
  1. Global gproc, which relies on full replication
  2. Local gproc perhaps also making use of the remote lookup functions [1].

Regardless of any specific issues of ‘global’, ‘gproc_dist’ et al, global name registration is problematic: it scales poorly, and you have  to contend with consistency issues.

- Gproc supports two different leader election approaches:
  1. gen_leader (whichever one you decide to trust)
  2. locks_leader (which is gen_leader-inspired, but uses a totally different algorithm)

One might paraphrase Sir Tony Hoare and suggest that there are two ways to pick a global synchronization library: one is to pick one so ubiquitous that the deficiencies are well-known, another is to pick one so obscure that there are no well-known deficiencies. Locks_leader has no well-known deficiencies. ;-)

I will not swear that gproc/gen_leader is more performant or reliable than ‘global’ (which is both supported and much more battle-tested). A reason for picking global gproc might be that the gproc semantics of registration and lookup are desirable, but I will say that I’ve received very little user feedback on global gproc. If a few users, or for that matter one dedicated user, would form a club and start beating it up, I will do my best to respond. :)

I personally believe more in gproc/locks_leader, at least long-term, but that branch is currently not up to date. I have not yet decided whether to commit to that version as the default.

[1] https://github.com/uwiger/gproc/blob/master/doc/gproc.md#await-3
https://github.com/uwiger/gproc/blob/master/doc/gproc.md#bcast-2
https://github.com/uwiger/gproc/blob/master/doc/gproc.md#wide_await-3

BR,
Ulf W

> On 05 Oct 2015, at 21:20, Josh Adams <josh.rubyist@REDACTED> wrote:
> 
> I'm interested in using gproc in distributed mode, and it's not
> immediately clear to me what the 'right' gen_leader implementation to
> use is.  Right now I'm using Torben Hoffman's, but I was hopeful there
> would be a nice document someone has written up regarding pros/cons of
> various implementations, ideally with a suggestion for which to use in
> the general case.
> 
> Is anyone aware of such a document?  Failing that, can anyone share
> anecdotes regarding how I might choose a gen_leader implementation, or
> whether or not distributed gproc is something I should base a
> distributed system around?  Really just using it for global process
> registry, and also taking advantage of the properties to provide a
> simple ad-hoc 'database query' style for finding processes that are
> fit for various purposes within the system.
> 
> Thanks in advance,
> 
> -- 
> Josh Adams
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list