On Wed, Sep 7, 2016 at 2:15 PM, Aristoula Goulia <arisgou...@gmail.com>
wrote:

> So I have a RepositoryWorker(for now it is only one) and one supervisor
> that watches the one worker.
> 1.In my current implementation all the requests (retrieve,store) pass fom
> the supervisor and the supervisor propagates the requests to the worker?
>   Is it a good design that all requests to the RepositoryWorker pass from
> the supervisor? Would it be better for the callers to get a reference to
> the underlying repo worker and send directly to
>   the worker rather the supervisor?
>

There's no one-size-fits-all answer here.  Having the supervisor pass
messages along to the worker(s) isn't a *bad* approach, nor an unusual
one.  It makes the supervisor slightly more of a bottleneck, so if you're
really slamming the system with zillions of requests to lots of workers it
might be more efficient to use direct ActorRefs from the caller to the
worker if that's appropriate architecturally (it often isn't), but I
wouldn't necessarily worry about that unless that traffic bottleneck
becomes an issue.


> 2.In my current implementation the supervisor for every request to the
> Worker does an ask and has a timeout so that it can inform the initial
> callers that their request TimedOut.
>   Kind of trying to guarantee that no caller will wait forever for a
> response from the RepoWorker(e.g it dies) by having this timeout on the
> supervisor.
>   Is it correct though that this responsibility lies with the supervisor
> or should the caller be responsible for this and use the ask pattern with
> the timeout? (Kind of feels the latter).
>   Because in the scenario where the supervisor dies e.g because all repo
> workers died, then noone will respond to callers request with the current
> implementation. Unless the callers watch the reposupervisor and on
> Terminated Mesage, the callers reject the pending and future requests.
>

I think you've kind of answered your own question here.  In principle, it's
probably more correct for the callers to have their own timeout, since the
supervisor can fail for various reasons.  How crucial that is is a
judgement call to examine in light of the system and how it's being used...

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to