gproc has been around for a while, so I’m assuming it needs no introduction. I’m also assuming that most are mainly using the local gproc functionality.
Distributed gproc (global - ‘g’ - scope) has been dependent on gen_leader, which among other things expects a fixed set of candidate nodes. I have long had a background project creating a leader election behavior based on the locks algorithm, but as I’ve been busy for the past decade on projects that don’t really use distributed Erlang, I haven’t had time to finish it.
The other day, I managed to bring locks_leader to a robust state, where it reliably handles split-brain scenarios, and I also managed to move gproc over to use locks_leader instead of gen_leader. It’s currently in a PR, as I would like to get some user feedback on it:
The main advantage of this is that locks_leader adapts seamlessly to ad-hoc Erlang networking, so it will pick up new candidates as easily as e.g. global does.
As it needs no pre-configuration, I have also made gproc_dist start automatically, and no longer be gated by the GPROC_DIST environment variable. It will start automatically if the locks application is present, which it of course will be if rebar3 is used. If the locks application can’t be started, local gproc still works, but gproc_dist won’t be available.
I’m aware that many people use gproc already, so I prefer not to merge the PR until I get some solid feedback from existing users.
BR,
Ulf