Coder Social home page Coder Social logo

Horde Process topology about horde HOT 12 CLOSED

sleipnir avatar sleipnir commented on August 25, 2024
Horde Process topology

from horde.

Comments (12)

arjan avatar arjan commented on August 25, 2024

choose_node receives all members of the cluster plus the identifier, so that means that you could just pick one of the members based on the identifer?

from horde.

sleipnir avatar sleipnir commented on August 25, 2024

@arjan Yes I agree. As long as I know at that point which identifier to choose. We would have to receive some information about which preferred Node the user wants to connect this Process

from horde.

sleipnir avatar sleipnir commented on August 25, 2024

This could be passed as an option to the DynamicSupervisor of the process.

from horde.

redrabbit avatar redrabbit commented on August 25, 2024

@sleipnir, I'm in the same boat. Currently looking for a way to start my processes on a specific node. My app require a specific node based on volume id (disk storage). Did you find a way to accomplish your goal?

@arjan, it seems that the identifier given to choose_node/2 is the hash of the child_spec (without the :id) in Horde.DynamicSupervisor.start_child/2. In my case it's not feasible because the params given to :start would differ between processes.

distribution_id = :erlang.phash2(Map.drop(child_spec, [:id]))

I think the changes made in #128 and being a fix for compatibility issues with Elixir.DynamicSupervisor broke the way of defining custom distribution strategies based on a specific identifier (or at least making it very cumbersome).

from horde.

sleipnir avatar sleipnir commented on August 25, 2024

@sleipnir, I'm in the same boat. Currently looking for a way to start my processes on a specific node. My app require a specific node based on volume id (disk storage). Did you find a way to accomplish your goal?

@arjan, it seems that the identifier given to choose_node/2 is the hash of the child_spec (without the :id) in Horde.DynamicSupervisor.start_child/2. In my case it's not feasible because the params given to :start would differ between processes.

distribution_id = :erlang.phash2(Map.drop(child_spec, [:id]))

@redrabbit Unfortunately I couldn't find a solution and ended up using a singleton process on the cluster. Still trying to find time to send a PR with a proposal for this feature but it's a little difficult

from horde.

arjan avatar arjan commented on August 25, 2024

@redrabbit the second argument of choose_node/2 is the list of members. If you filter that list first you can control the set of nodes which get selected. This is how I implemented it:

        def choose_node(identifier, members) do
          members = Enum.filter(members, fn member -> ... end)

          Horde.UniformDistribution.choose_node(identifier, members)
        end

from horde.

redrabbit avatar redrabbit commented on August 25, 2024

@arjan like I stated in my previous comment, the identifier passed to choose_node/2 is not very usable because it's the hash of child_spec without :id. So how do I filter my members based on the identifier?

from horde.

arjan avatar arjan commented on August 25, 2024

I'm sorry, I did not read it carefully enough.
I think it would be a nice addition to add the original child_spec as a third argument to the choose_node callback function.

from horde.

CimimUxMaio avatar CimimUxMaio commented on August 25, 2024

¿Any updates on this issue?
I'm having the same problem, I need some of the child's info to filter out members from the list.
¿Any new ideas on how to work around this?

from horde.

arjan avatar arjan commented on August 25, 2024

It seems easy enough to create a branch add this third argument, and then create a PR for it?

AFAICT you only need to change these lines

from horde.

fmbraga avatar fmbraga commented on August 25, 2024

choose_node/2 receives a child_spec. Since child_spec is an ordinary map, you could add a :preferred_node into it, and choose_node would have something to decide where to start your process.

from horde.

sleipnir avatar sleipnir commented on August 25, 2024

Closing this because PR #239 can solve the problem.

from horde.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.