#Highly available gen server

8 messages · Page 1 of 1 (latest)

molten cradle
#

Hi,

Let's say I have application node A, B and C and I have a global registered gen server registered, so it's only spawned on node C. When node C dies, I want it to be started on either note A or B.

Is this possible? It seems like it's not happening by default.

Additional information
I'm writing a chat module for my application where I spawn a gen server for each chat session (only holding 10 chat messages per process).

I've used a dynamic supervisor so I can spawn them alá carte and I'm using a global registry so only one gen_server for the chat session can be spawned.

This worked great until I tried to add and remove nodes from my elixir cluster.

molten cradle
#

I guess I could implement my own thing using a monitor

native elm
undone kestrel
native elm
#

Such a good name.

molten cradle
#

Ah yes, Horde is something I've had my eyes on. I thought there would be something in OTP that handles it for me though 🙂

undone kestrel
#

For what it's worth, you're probably better off using something like persistent hashing + a hashring to spread processes across your cluster rather than having every node monitor each one. Especially since it sounds like you will have many