You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A useful actor pattern is an actor that spawns and deletes worker actors to scale with the traffic it is receiving. This will require a change to the actor client and the base stream that is used by the actor runtime.
Design
The work actors will be created by a function that is given to the manager state. This closure will be called whenever the manager needs to spawn a new worker. Instead of the standard unbounded channel, each worker will have a bounded channel of some small capacity (say, 10 message). The manager will even distribute messages between workers. If at any point it finds that it can not pass on the message to any worker, it will spawn a new worker and pass the message on to it. Every worker will have a timeout duration. If the worker goes that length of time or longer without processing a message, it will be shutdown (either by itself or the manager).
Requirements
This design will require a change to the message passing model. Currently, SinkActors only ever have an unbounded channel through which it can receive message. This was a decision made prior to this crate being standalone. It would be ideal to generalize this so that users can pick their preferred channel types to use as well as enabling this feature.
Alternative
Backpressure is a requirement. If generalizing over channel types is too difficult, a secondary stream that contains a bounded channel can be attached, and the manager can forward messages via that channel.
The text was updated successfully, but these errors were encountered:
About
A useful actor pattern is an actor that spawns and deletes worker actors to scale with the traffic it is receiving. This will require a change to the actor client and the base stream that is used by the actor runtime.
Design
The work actors will be created by a function that is given to the manager state. This closure will be called whenever the manager needs to spawn a new worker. Instead of the standard unbounded channel, each worker will have a bounded channel of some small capacity (say, 10 message). The manager will even distribute messages between workers. If at any point it finds that it can not pass on the message to any worker, it will spawn a new worker and pass the message on to it. Every worker will have a timeout duration. If the worker goes that length of time or longer without processing a message, it will be shutdown (either by itself or the manager).
Requirements
This design will require a change to the message passing model. Currently,
SinkActors
only ever have an unbounded channel through which it can receive message. This was a decision made prior to this crate being standalone. It would be ideal to generalize this so that users can pick their preferred channel types to use as well as enabling this feature.Alternative
Backpressure is a requirement. If generalizing over channel types is too difficult, a secondary stream that contains a bounded channel can be attached, and the manager can forward messages via that channel.
The text was updated successfully, but these errors were encountered: