Hi Rory,
Thanks for the response. It clarifies some questions. But I have more
based on your response-
"it would be easy to pause the poller if it is getting too far ahead of the
workers. "
How can this be accomplished?
I understand that the actors created as part of another actor will be
children. But question is what will be the best pattern to create the
actors?
1. In "preStart"-
If we create N instances of actors (using SmallestMailBoxRouter),
then for the duration of the actor system, there can be upto N instances,
right? So for every polling period, the number of instances of the worker
actor will be upto 'N'.
2. In "receive"
Creating N instances of actors per message received. So for every
polling period, we are going to be incrementing the number of actors.
If I stop the worker actor after the file processing, then will it be
additional overhead caused by starting them again for the next polling
period?
Regards,
Sridhar.
On Thursday, December 19, 2013 6:25:15 PM UTC-8, Sridhar Sreenivasan wrote:
>
> Hi,
> Iam new to Akka, and have been designing an application in
> akka(2.2.3)/scala. Gist of the application is to poll for files from
> external source every minute, process the file (read) and send it for
> downstream processing.
> I have a master actor, that creates region pollers (the external source
> can be located in multiple geo regions). The region pollers then polls for
> files in the specific region and creates child actors that processes the
> files.
> Current mechanism-
> 1. MasterPoller created and scheduled periodically, by sending a message
> in a Main
> 2. The MasterPoller actor creates the RegionPoller actor upon receiving
> the message
> 3. The RegionPoller creates the FileWorker actors upon receiving the
> message
> 4. FileWorker processes the files.
>
> First question, is this an acceptable pattern of creating actors within
> the "receive" method. Or should it be created as part of the "preStart" of
> each actor. Should I terminate the actors in step 3. and 2. after
> processing? Or if I don't, will they be reused when the MasterPoller
> creates the actors again? I fear that with the implementation I currently
> have, the number of actors are going to be incremented with no explicit
> "stop". But what's the performance impact of stopping the actors, and
> recreating them?
> Secondly if I create the actors as part of "prestart" then they will be
> reused. But in the case where FileWorker is processing, and then the
> MasterPoller is scheduled for the next run, and sends a message to
> RegionPoller. When RegionPoller sends the message to FileWorker, it's going
> to be blocked, right?
> Any suggestions on what the best practices are?
>
> Regards,
> Sridhar.
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.