socketcluster icon indicating copy to clipboard operation
socketcluster copied to clipboard

RFE: allow running multiple scc-state servers that vote the leader automatically

Open mikkorantalainen opened this issue 2 weeks ago • 3 comments

As documented at https://github.com/SocketCluster/socketcluster/blob/master/scc-guide.md#notes the current design requires that exactly one scc-state server is running for the cluster.

I'm asking for an improvement that I could run one scc-state server per system in the cluster and SocketCluster would automatically select one as the leader and other scc-state servers could just wait as hot standby systems, ready to take over if the hardware running the leader scc-state failed.

This would remove the only remaining single-point-of-failure in SocketCluster if I've understood its behavior correctly.

I think there wouldn't need to be any fancy way to vote the leader. Just make the first server to start the leader and every next server would join in queue to be the next leader. And maybe have a config specifying minimum amount of servers in the queue before designating one as the leader to avoid split brain situation? (For example, for 3 server cluster, one would specify minimum of 2 servers until scc-state server is elected and in that case the first server in the system would be the leader.)

mikkorantalainen avatar Jun 20 '24 12:06 mikkorantalainen