What if you were trying to create a game and wanted to take advantage of Elixir clustering?
For example, you could use Registry and a GenServer to hold the game state, but a problem you may run into is that each node may create its own GenServer…resulting in duplicate games. (this does actually sound kinda fun, but obviously not desired…)
We generally recommend using libcluster for clustering replicas together.
By starting up using
:global when starting the game server, this allows you to pass the game state through libcluster to the node with the active state for the game.
We have some users that even run multiple applications in Gigalixir using libcluster to bridge the applications interprocess communication.