josevalim

josevalim

Creator of Elixir

Hello everyone,

I would like to propose the addition of the Registry project to Elixir:

https://github.com/elixir-lang/registry

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. :slight_smile:
You can learn more in the documentation:

http://elixir-lang.org/docs/registry/

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.

Showing Posts 34 to 25

tompave

tompave

Thank you both, that was very helpful!

gon782

gon782

There is a talk about the DHT plans here:

dom

dom

The project was briefly mentioned at the conference in Stockholm last year:

It’s the distributed hash table mentioned as an alternative to Global on the last slide of “News from the OTP team.

There was also this tidbit:

http://www.erlang-factory.com/sfbay2017/christopher-meiklejohn.html

Recently, attempts have been made to resolve the problems of Distributed Erlang: SD-Erlang and Ericsson’s planned port of global to the Kademlia DHT are focused on reducing the amount of information that each node in the global registry needs to replicate, but that only temporarily mitigates the problem.

That’s about all I’ve heard personally.

tompave

tompave

Doesn’t global predate the Elixir Registry and this whole thread by years? I think that @josevalim was referring to something else. Still, I couldn’t see reference to any new work in progress in the global docs.

NobbZ

NobbZ

Perhaps in the documentation of the global module :wink:

tompave

tompave

Does anyone know where can I find more info on the OTP Team’s plans on a distributed registry?

josevalim

josevalim OP

Creator of Elixir

Because the name is not optional on this case.

No conventions as far as I know.

eidge

eidge

Hey José,

I was taking a look at the code and was puzzled over two things:

  • First one is, why use a positional argument for the registry name, rather than using the convention of passing name in the keyword list options.
  • The second one is the reasoning for defining multiple modules inside the same file? I was trying to locate Registry.Supervisor and it took me a while to understand it was in the file rather then in a Registry folder.

Is there a convention in place for cases like this?

josevalim

josevalim OP

Creator of Elixir

The Registry has been merged into Elixir master.

josevalim

josevalim OP

Creator of Elixir

Yes but it doesn’t mean having a partition per core is necessarily the way to go. If you don’t expect an intensive workload, using 4 or 8 partitions for 40 cores would be fine.

Being the most pessimistic, I would do a factor of 0.25 on the number of cores. So for 40 cores, I would do 10 partitions. Like this: System.schedulers_online |> div(4) |> max(1).

Where Next? Top

Trending in News Top

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews