[erlang-questions] pg2 vs gproc?

Michael Truog mjtruog@REDACTED
Wed Jun 6 18:44:59 CEST 2012


The other differences are mentioned in previous email threads.  pg2 replicates all name lookup information in a way that doesn't require consistency (it does use ets though, if you don't want to use ets, there is an example here https://raw.github.com/okeuday/CloudI/master/src/lib/cloudi/src/list_pg.erl).  gproc uses gen_leader so it maintains a central name lookup authority.  So, pg2 is AP from the CAP theorem, while gproc is CA.  That means gproc has issues with partition tolerance, similar to mnesia.  To me, gproc is a method by which you are able to introduce global variables into your Erlang program.  This helps beginners that are not working on large codebases, but it is generally only for Erlang that is limited to a single node.  An implementation of gen_leader behavior that is suppose to have better partition tolerance is here https://github.com/ngmoco/gl_async_bully , but I don't know the details.  I don't see leader election as necessary in Erlang, though it is a
fun intellectual exercise.

On 06/06/2012 05:10 AM, Motiejus Jakštys wrote:
> Bump
>
> On Sat, May 26, 2012 at 10:38 PM, Motiejus Jakštys
> <desired.mta@REDACTED> wrote:
>> Hi,
>>
>> For term() to pid() mapping I've always used gproc. For the same thing
>> my coworker always used pg2.
>>
>> I am making a comparison now. There are some features in gproc which are
>> not in pg2:
>>
>> * Await for registration
>> * Per-process properties
>> * Aggregate counters
>> * QLC
>>
>> Whereas pg2 "natively" supports mapping one key to several processes
>> (which can be easily achieved with QLC in gproc).
>>
>> Any more differences between them?





More information about the erlang-questions mailing list