Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: multicast #10

Open
pjz opened this issue Mar 25, 2016 · 4 comments
Open

Feature: multicast #10

pjz opened this issue Mar 25, 2016 · 4 comments

Comments

@pjz
Copy link
Contributor

pjz commented Mar 25, 2016

It would be nice if .tell()/.send()/.ask() accepted a list for the first arg (actorAddr), meaning to send copies of that message to all of the listed destinations. I believe there's a gain in having thespian do this instead of the user/actor doing it, because thespian can re-use the message serialization.

The motivation for this was pondering the implementation of some pub/sub-ish functionality in thespian.

@kwquick
Copy link
Contributor

kwquick commented Mar 25, 2016

Interesting idea... I'd like to take a little time to think through the implications and implementation of this. Thank you for the submission.

@j3hyde
Copy link

j3hyde commented Feb 24, 2017

I'm new to Thespian but having looked into ZeroMQ in the past I had similar thoughts. I found that the Troupe concept is quite similar though. With the grain of salt that I'm not familiar with the underlying architecture, it seems like either the Troupe or the specific .tell()/.send()/.ask() call would specify a policy of send one-by-one/round-robin vs. send-to-all while the transport implementation (such as multicast vs. zmq vs. some other protocols) would be down to the ActorSystem to decide. That way the Actors only know that work is to be submitted to many other Actors at once and a multiprocTCPBase would simply duplicate messages while a multiprocUDPBase could have the option to multicast and a multiprocZMQBase could use it's own messaging paradigm (for example).

@kwquick
Copy link
Contributor

kwquick commented Feb 28, 2017

I would like to learn more about the use case(s) for this functionality.

At present, each Actor has an associated Address which uniquely identifies that Actor, and therefore the message sent is processed only once. This is still true for the Troupe scenario: the Address used externally is for the Troupe Leader, which in turn chooses only one of the workers to send the message to. Additionally, some of the transport implementations in Thespian attempt to ensure delivery of the message to the target Actor (asynchronously, and unbeknownst to the Actor itself)

If I understand correctly, there is interest in creating a group of Actors and using a single send() to send a message to all of the Actors in the group. What are the expectations of behavior for this mode?

  • Should each Actor be individually addressable as well as receiving "multicast" traffic?
  • Message delivery would probably need to be best-effort for all transports. This is currently the way the UDP transport works, although the TCP transport attempts to ensure delivery to the target; the latter would probably need to devolve to a best effort case as well.
  • At present, if a target actor encounters multiple exception failures when processing a message, that message is returned to the sender in a PoisonMessage wrapper. When used in this group scenario, there could potentially be a number of PoisonMessage returns for any single send.
  • At present, if a child Actor exits, the parent receives a ChildActorExited message. The behavior for a group relates to the first item above: if Actors are individually addressable, then the exited messages can be unique, but if the group appears as a single entity to other Actors, including the parent, there could be multiple ChildActorExited deliveries for what would appear to be the same Actor.

It may be that this use case is better served by a "Router" Actor rather than embedding the functionality into Thespian itself. As j3hyde pointed out, the Router implementation could be similar to the Troupe model, replicating messages to all children rather than to just a single idle worker.

@pjz
Copy link
Contributor Author

pjz commented Mar 1, 2017

As I said in my original submission, the gain if having Thespian do it is having serialization overhead of O(1) instead of O(n). I don't think the group needs to be reified as a group, it'd just be nice to have an easy way to put the same message in all their inboxes. What that means copy-wise (n copies? Or one copy with n references?) Is probably up to the transport implementation. But even n copies is faster than n serializations.

kquick added a commit that referenced this issue Mar 29, 2020
Fixed inspect deprecation warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants