On 26 Oct 2016, at 11:36, José Valim <jose....@plataformatec.com.br> wrote:Registry:* Functions that behave exactly the same: start_link/3, dispatch/3, keys/2, unregister/2
Looking at docs for dispatch/3, keys/2, unregister/2, I see different explanations for unique vs duplicate. For example for keys/2: "If the registry is unique, the keys are unique. Otherwise they may contain duplicates if the process was registered under the same key multiple times.”. So the signatures might be the same, but behavior varies.
It’s true that it’s more like an ets syndrome, but it still feels these two versions are doing different things. One is for a unique registration, another for process groups. Separating them would slightly simplify interface of each.
For example, in a registry I don’t need dispatch/3, but rather value/2.
On 26 Oct 2016, at 12:43, José Valim <jose....@plataformatec.com.br> wrote:> I could make the docs worse to prove this point but I would prefer to keep the docs clear with examples and conditions than to be succinct.Unless it turns out not listing how each registry behaves is clearer. In this case, we should remove the conditional paragraphs. Feedback here is appreciated.
> Except it isn't a process group. You can't lookup all processes with their values on a given key.We could make it a process group though but it doesn't play well with partitioning (we need to do N serial lookups where N is the number of partitions). Food for thought.
Being able to dispatch/3 without caring what is the registry kind may be useful.
And for when you need the value, there is whereis/2.
* Process registry: to register process with dynamic names. Often Elixir developers need to rely on gproc or other tools.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/08f13768-4b85-43d9-816f-dffd0951854c%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/05769888-7656-4eca-955f-0e3c5618a701%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/C1FA9F24-A5C9-455C-A161-DBBC9DCA57AE%40gmail.com.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LN_CU6w%2BCgMrbr1%2Be4r%3DktHqONOS%2Bik5XR6BG2zjWBBw%40mail.gmail.com.
Hey José,The use case I've been working on/with, and am most interested in, is a better distributed (global) registry, is this something that Registry will support (or perhaps even currently supports)? I haven't yet had time to look at Registry in detail, but it was the first thing that came to mind when I saw the announcement.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CABKyvT7k7UUjcxcfThs0KdxNRyH2Wp50LQq3iBh5rQ8JvJKQYg%40mail.gmail.com.
Right, distribution implies some form of replication, which is what mnesia does under the covers. Mnesia isn't a good fit though, because it can't handle dynamic node membership in a cluster (so any kind of autoscaling orchestration is out). The library I wrote uses eventually consistent replication, but I'd love to see a solution which is either part of Registry, or can be built on it as an extension of some kind.
Hello everyone,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 topicThere 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 exact 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 (gproc seems to be serial on its default configurations).Please give it a try and let us know what you think.