The Hop Atlas protocol
GenServer
to manage their own state.
Processes in Elixir are represented by their PID (process ID), denoted by 3
integers, which are transitive across Elixir nodes. As you can imagine,
developers want to give their own internal names and IDs to processes so they
can refer to them using existing internal terms gathered from external input
like an API or database.
There have been many different variations created by the Elixir & Erlang
community to solve this issue, including some in the Erland OTP standard
library, however they all have different drawbacks & tradeoffs. Without
focussing on local process managers, which are trivial to implement, inter-node
process management solutions include:
All of these solutions embrace an eventually consistent model, where certain
nodes in the network may have a different view of where processes live. This
model does not work for our use case. We need every node to be able to know
where a resource lives, no matter what - if not, we could lose messages, or
route them to the wrong session process.
One way to solve this would be to implement a cluster-wide lock or semaphore for
resource sync, however this would add latency and introduce a lot of
un-necessary gossip between nodes. We need an atomic, low-latency process
registry across all nodes.
rrp:us-east-1/hop@node-1/channels/project_0:channel_0
which takes the format of:
rrp:<region>/<node>/<resource_type>/<resource_id>
:erlang.nodes/1
). If not, it can start it on the current node
instead, and update the RRP value.