I have a cluster of c-nodes that connect to my erlang instance and need to have messages distributed amongst them. My current method of doing this is to have a -define
of the list of cnode name atoms, and a gen_server
which simply responds to request for the names by rotating the list and sending back whatever is currently at the front, and the requesting process then interacts with whatever node it was given. Unfortunately these c-nodes are very heavily used and that gen_server
is backing up significantly (staying at around 2k-6k messages in its queue).
I'm wondering if there's any other way I could "load balance" across these c-nodes. My initial thought was to just pick a random element from the list whenever a process needs to interact with one, but that seems extremely inefficient to me. Are there any other methods I'm not thinking of?