-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Remote message broadcasting #92
Comments
In think we should synchronize this with the other idea of wrapping all messages in an envelope as proposed in #69. For example, how would we handle message headers for a broadcasted message sent over the wire? Could we build broadcasting into the general message envelope by having a list of recipients? Or would it be better to wrap one of the envelopes inside the other? (and if so, in which order?) I'm leaning towards either merging the two envelopes, or wrapping the broadcast envelope in the message envelope. |
I think the two are separate. I see As I understand it, a |
As I see this, there are two ways this could be implemented:
We have a LocalEnvelope, a RemoteEnvelope and a BroadcastEnvelop. all of which carry the message header information to the receiver. Or
This would mean that if we broadcast to a remote node, the broadcast envelope would have to contain a RemoteEnvelope internally. in order to also carry the header information. |
One thing we could do, is to let the current So a message could be sent to 1-n actors on a remote nod. Not sure how this would affect allocations in the default (1 target) case. |
Q: What is the difference between a
|
A LocalEnvelope could carry a |
Not planned for now |
Abstract
Sending a single message to multiple remote PIDs can consume potentially large amounts of memory and CPU resources. We propose to add support for batching these messages so they can be serialized and deserialized once per node.
Background
Broadcast Messages
Group routers allow the user to add arbitrary PIDs to receive messages based on the routing strategy of the router. These PIDs could reside on many remote nodes. Certain scenarios allow a single message to be forwarded to all of the PIDs, which can be very inefficient if many of them are remote. In the case of a broadcast router, messages are always forwarded to all the routees. In addition, a router that receives a
router.Broadcast
message will forward the inner message to all its routees.As an example, a group broadcast router with 1,000 PIDs residing across 10 remote nodes would result in a single message being serialized and deserialized 100 times on each node. In addition, the source node will have to serialize the message 1,000 times. This equates to a potentially large increase in memory and CPU resource usage on all involved nodes.
Proposal
BroadcastEnvelope
We propose creating a new message which represents a broadcast of an inner message to a set of PIDs on a remote node:
The
typeName
andmessageData
represent the serialized protobuf message that will be reconstituted at the remote and delivered to the local PIDs. TheIDs
array is theId
component of thePID
, given theAddress
is redundant.An actor on the remote node will deliver the inner message to all PIDs listed in the
IDs
array.PIDSet.Tell
Add
Tell
method toPIDSet
, allowing efficient broadcast of messages to a set of PIDsThe text was updated successfully, but these errors were encountered: