[erlang-questions] [ANN] Syn: a global process registry

Fred Hebert mononcqc@REDACTED
Tue Jul 7 15:43:19 CEST 2015


On 07/06, Roberto Ostinelli wrote:
>Syn is a process registry that has the following features:
>
>   - Global (i.e. a process is uniquely identified with a Key across all
>   the nodes of a cluster).
>   - Any term can be used as Key.
>   - Fast writes.
>   - Automatically handles conflict resolution (such as net splits).
>   - Configurable callbacks.
>

One of the things mentioned in your article was that because you used 
mostly unique device names, you didn't have to worry much about 
conflicts in names, and could consequently relax the consistency 
properties to go for eventual consistency.

There is however no details about how this takes place. Attributes that 
are fun to know are:

- What's the conflict resolution mechanism
- how long does it take to detect a conflict
- how long does it take to resolve a conflict

For example, I looked at the following code: 
https://github.com/ostinelli/syn/blob/master/src/syn_consistency.erl#L255-L262

    case CallbackModule of
        undefined ->
            error_logger:warning_msg("Found a double process for ~s, killing it on local node ~p", [Key, node()]),
            exit(LocalProcessPid, kill);
        _ -> spawn(fun() ->
            error_logger:warning_msg("Found a double process for ~s, about to trigger callback on local node ~p", [Key, node()]),
            CallbackModule:CallbackFunction(Key, LocalProcessPid) end)
    end

And this makes it look like it is possible for two nodes to find 
conflicting pids, and if they find it at the same time, both processes 
are killed at once. This can be worked-around by setting up a function 
that always picks the same pid no matter who executes it 
(exit(max(P1,P2), kill), for example), but killing the local pid always 
risks having all nodes involved making that same decision and then 
having nobody left as soon as there's a conflict.

So what could be the impact of this on a cluster where the conflict rate 
is higher, say 80%? Would an app like Syn mostly kill my entire cluster 
if I don't configure it properly? Or maybe I misunderstood something 
from my very brief reading of the code.

The speed boost is interesting, but without more details about the app's 
handling of conflict when the uniqueness of names isn't guaranteed, it's 
hard to make myself a solid idea of how it would go in the wild.

Regards,
Fred.



More information about the erlang-questions mailing list