I would like to propose the addition of the Registry project to Elixir:
The Registry project is a local and scalable key-value process storage in Elixir. It encapsulates 3 known use cases:
- Process registry: to register process with dynamic names. Often Elixir developers need to rely on gproc or other tools.
- Code dispatching: dispatch a module/function associated to a given key
- PubSub implementation: send messages to local processes registered under a given topic
There are probably other use cases waiting to be discovered.
You can learn more in the documentation:
The project clocks only 700LOC with documentation and performs well. We have extracted, improved and generalized the patterns from Phoenix.PubSub, the implementation used to manage and publish messages to 2 million subscribers.
When benchmarking thousands of processes registering serially, it is twice slower than local atoms, albeit 33% faster than gproc. On concurrent cases, it distributes well across all cores, becoming only 15% slower than local atoms, and 3x faster than gproc on a machine with two cores (gproc seems to be serial with its default configurations so the difference will be even bigger on more cores).
Please give it a try and let us know what you think.