In Elixir and Erlang, what are the best ways to manage pid lookups in a cluster?
My current solution:
Inside each node, I use gproc to register my pids with custom keys {:n, :l, “game-1001”}.
Across the entire cluster (tiny cluster less than 5 ec2 instances), I use a global shared
storage like DynamoDb to store the mapping from custom keys to pids.
To find a particular process running a game, I would first check locally and then with DynamoDb.
To maintain the consistency, I monitor each process, remove it from DynamoDb when it dies.
Whenever a died process is restarted by Supervisor, the pid is added to DynamoDb.
This way requests can always be routed to the right node in the cluster.
I wonder if anyone has run into similar problems and may have better solutions.
Thanks