ostinelli / syn

A scalable global Process Registry and Process Group manager for Erlang and Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using syn in dynamic nodes loading topology

elpddev opened this issue · comments

Given an app, which its nodes are not determined at the start, can Syn be used in that context?

The app in my case can accept new manually started nodes to scale performance. My problem is: The connection between the new node and the cluster can be initiate from the new node, or from one of the cluster old nodes.

From what I see in the syn source, at syn:init, there is a step to initialize mnesia table on the current nodes list of the current node. After, it tries to duplicate the syn table to the current node if it is already exists on other nodes.

Is there a functionality in Syn that I can use from the connection initializer node to initialize Syn on other nodes after connecting to them ?

I don't know what is the connection initializer you are referring to, however as per the README you should just call syn:init/1 from the newly added node - after it has connected to the other nodes in the cluster.

You can do it:

  • When you start your app on the new node, just like in the README's example;
  • Listening to the events that tell you a new node is up, and calling syn:init/1 on the new node then;
  • From whatever handles your connections.

HOWEVER: ensure that you call syn:init only once on a running node, otherwise the automerge mechanisms will not work.

Hope this clears up.

Thank you for the reply.
I will check how this integrates with the architecture (I think of using erlang node connect event) I have at hand an open another question if needed.