I have a cluster of nodes, each node containing some processes that are used primarily for maintaining and retrieving state. That state information is read frequently and does not change very often. When I do a read, it always has to call local processes AND remote processes. Writes are typically local only.
Currently I am using the awesome syn library, adding each process to global groups, and then using
:syn.multi_call/3 to retrieve state from all the processes on the cluster. So far this has worked mostly fine, except for some bugs resulting from syn’s inherent eventual consistency.
Another solution I had considered was to start up a local process registry on each individual node (e.g.
Registry), and then have a single “manager” or “coordinator” process that would know how to call all its local processes and then return the results en masse to remote nodes with a single remote call (e.g.
GenServer.multi_call/4 to the coordinator only).
Does this latter pattern have a name? What tradeoffs would I have to consider in terms of performance and flexibility versus a global process registry? It seems like the coordinator could easily become a message bottleneck but I’m not sure how to design around that.
In this particular case should I just be create an mnesia table and use that to sync up the state across nodes?