Syn - a global Process Registry and Process Group manager

All,
Syn (short for synonym ) is a global Process Registry and Process Group manager for Erlang and Elixir. Syn automatically manages addition / removal of nodes from the cluster, and is also able to recover from net splits.

v 2.0.0 has just been released. You can grab it from the usual places:

Syn v2 is a complete rewrite and has been driven by a series of considerations, mainly to substitute the usage of automated mnesia replication features in favour of a custom solution. If you are curious, I’ve written about it here: http://www.ostinelli.net/a-journey-to-syn-v2/

As always, feedback welcome. Thank you,
r.

13 Likes

All,
Syn v2.1 has just been released. The main highlights are:

  • The mnesia dependency has been removed in favor of ETS tables.
  • Conflict resolution has been further improved, and now it also uses a basic system clock to compare and resolve conflicts (this mechanism can be improved with custom implementations such as vclocks if the native one is considered to be insufficient).
  • Experimental anti-entropy support.
  • Additional helper methods have been added for SysOps.

This is a recommended update. You can find it in the usual places:


Best,
r.

8 Likes

Hi @ostinelli,

Any Elixir example for this syn ? Also any Elixir Hex doc?

Thanks,
Ajaxdone

How to configure on Elixir for the global cluster mode? please provide an example.

Any Elixir example for this syn ? Also any Elixir Hex doc?

All the doc is self-contained in the repo’s README. You can call syn functionalities by using Elixir’s standard way of calling Erlang libraries, for instance to register a process:

:syn.register(name, pid)

How to configure on Elixir for the global cluster mode? please provide an example.

Syn auto-configures to run on every node of the cluster, so you do not need to do anything besides starting it as specified in the README.

Best,
r.

1 Like

thank you @ostinelli
Very cool, I just connect to another node like this, GROUPS AUTOMERGE happen, and all the process on another node can be seen now:

Node.connect(:"node2@*****-MacBook-Pro.*****.home")
:syn.get_members(:good_group)
[#PID<19807.1095.0>]

@ostinelli
So on a Phoenix deployment, can I just use it cluster mode: https://dockyard.com/blog/2016/01/28/running-elixir-and-phoenix-projects-on-a-cluster-of-nodes

or need to run a libcluster like ?

Syn does not depend on libcluster. As long as you have a cluster, and run Syn on every node, you’re good to go. You may need libcluster for your own cluster management needs.

1 Like

@ostinelli
If I already registered a process to :syn using (Name, PID) , is there a way to use self() the PID to get back the Name when registered on :syn ?

Just want to seek if the convenience already there, I definitely can get another global KV store running to save the (PID,Name), but just want to see if :syn already has the functionality.

hi, I’m also intested in v1 ? Where could I see the source code of v1?

It’s in github, so you can just rewind the tags. Latest v1 is here:

All,

Syn v3 has just been released. For those who don’t know what it is, Syn (short for synonym) is a scalable global Process Registry and Process Group manager for Erlang and Elixir. Syn automatically manages dynamic clusters (addition / removal of nodes), and is also able to recover from net splits.

v3 builds upon the past experience to improve scalability & handling, and the main differences are:

  • Syn is now based on Scopes. A Scope is a way to create a namespaced, logical overlay network running on top of the Erlang distribution cluster. Nodes that belong to the same Scope will form a subcluster: they will synchronize data between themselves, and themselves only.
  • The callback mechanism has been redesigned to support local callbacks so that every node is notified of register / unregister / join / leave and update operations. This allows it to properly support node crashing & net splits. Since the existence of Scopes, it is also now possible to define a different callback logic per Scope.
  • All rpc have been removed, and the registry conflict resolution doesn’t use a global lock anymore. This allows for better scalability and should allow for mixed-version cluster support, since internal messages are now all versioned.
  • Tests are now based on a 3 nodes cluster and include concurrency tests as well.

Docs have been published with elixir’s format and are available here:

https://hexdocs.pm/syn

You can get Syn from the usual suspects [1][2].

A quick thank you note for Fred Hebert, who has taken some of his time to provide me with some helpful input on the design.

Feedback and questions are always welcome.
r.

[1] syn | Hex
[2] GitHub - ostinelli/syn: A scalable global Process Registry and Process Group manager for Erlang and Elixir.

15 Likes

Thank you for a nice library. I have used horde before and it uses [

bitwalker/libring

](GitHub - bitwalker/libring: A fast consistent hash ring implementation in Elixir) to uniformly distribute processes across a cluster. Does syn distribute / redistribute processes across a cluster, if yes, which distribution mechanism does it use.

Syn is a global Process Registry and Process Group manager. It does not distribute / load balance processes across the cluster, though with the available API it shouldn’t be hard to implement a workers manager if that’s waht you’re after.

1 Like