[erlang-questions] preserving state through a gen_server restart
Michael Truog
mjtruog@REDACTED
Sat Oct 20 04:27:44 CEST 2012
"Plain Old OTP" provides pg2. gproc depends on gen_leader (external to OTP) to try and have a single resource for consistency, so it can have issues due to this focus on consistency. pg2 just updates process registries locally, while making sure the changes are provided to remote nodes. Both process registries use ets. pg2 is the only one used by OTP internally.
On 10/19/2012 06:57 PM, Joseph Wayne Norton wrote:
> Ivan -
>
> Ivan -
>
> Hi. I don't fully understand the needs of your application so please keep that in mind.
>
> A few suggestions/comments:
>
> - gproc is built using "Plain Old OTP". gproc uses an ets table and a gen_server process to store and to manage it's state.
>
> - If you decide not to use gproc, I'd recommend modifying your "my_lambs" process to use ets to store and to manage your state. I'd recommend to create a process different than your "my_lambs" process to be the owner of this ets table.
>
> - Check this module (https://github.com/norton/gen-ets/blob/dev/src/gen_ets_reg.erl) for one recipe on using ets for such purposes. This module implements a *very* simple process registry.
>
> Cheers,
>
> Joe N.
>
> On Oct 20, 2012, at 6:02 AM, Ivan Uemlianin <ivan@REDACTED> wrote:
>
>> Thanks. gproc does look very useful and I'll read the tutorials. In the meantime, how is this kind of thing done with Plain Old OTP?
>>
>> Best wishes
>>
>> Ivan
>>
>>
>> --
>> Froh, wie seine Sonnen fliegen, ...
>>
>>
>> On 19 Oct 2012, at 16:09, Joseph Wayne Norton <norton@REDACTED> wrote:
>>
>>> gproc is handy way to manage processes by name.
>>>
>>> On 2012/10/20, at 0:03, Ivan Uemlianin <ivan@REDACTED> wrote:
>>>
>>>> Or is there another way of doing this?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
More information about the erlang-questions
mailing list