Question

I have a design whereby a Supervisor Actor creates an Actor based on the Akka TimerBasedThrottler class. This Actor dynamically creates child Actors to execute web service requests to upstream systems. This works fine at small scale however as the number of requests start to build up my Actor mailboxes start to grow and response times deteriorate.

What i need is the ability to create a RoundRobinRouter which will load balance requests to more than one instance of the Supervisor. However i need the TimerBasedThrottler to be a single instance which is shared by each Actor instance created by the RoundRobinRouter.

Can someone help me with how i can use the RoundRobinRouter to create new supervisor Actor instances passing in a single instance of the TimerBasedThrottler?

Était-ce utile?

La solution

Your description seems contradictory: the throttling will limit the number of requests that can be processed, and adding a Router in front of that will not help because the limit is to be imposed on the whole group of actors.

When your system has a capacity limit like this, it is crucial to build in flow control: your supervisor will have to monitor the number of outstanding requests and limit that to keep the response times below your required limit. If more requests come in there is nothing you can do but to reject them (i.e. send back a negative reply right away).

Autres conseils

  1. public class Master extends UntypedActor { ----- ----- public Master() { workerRouter = this.getContext().actorOf(Worker.createWorker().withRouter(new RoundRobinRouter(8)), "workerRouter"); } // This is best Effort code executed in min. time in akka .
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top