Hello Akka experts,

I have another question regarding Agent. Based on my scenario explained in 
my post - there is a situation where i need to share some mutable state 
between DIFFERENT actor.

For example:
The DatabaseWorker is happily processing data in a while loop for Request 1.
Assume it has split the query into 4 times slices ….

while (moreTimeSlicesToProcess)
{


}

On Monday, April 7, 2014 1:05:06 PM UTC-4, MV wrote:
>
> Hi Bjorn,
>
> Thanks a lot for getting back to me. I was able to try out the 
> ConsistentHashoungRouter as per your suggestion and worked really nice. We 
> did a little stress test over last week and worked as expected.
>
> Thanks again for all the help.
>
> Meena
>
> On Tuesday, April 1, 2014 4:20:59 AM UTC-4, Björn Antonsson wrote:
>>
>> Hi Meena,
>>
>> On 27 March 2014 at 17:22:21, MV ([email protected]) wrote:
>>
>> Hi Endre, 
>>
>> Thank you again and I am trying the code out. I had another quick 
>> question though - how do you release and actor reference if the specific 
>> request is ALL done?
>> For example let's say that the Result Processor has finished all the work 
>> for the 3 data points (R1, R2, R3) and we do not have to hold this hash 
>> mapping anymore - how do I release that hash mapping?
>> Does AKKA automatically release resources and assign that actor to 
>> another request? How is that taken care of?
>>
>> I apologize in advance if my wording of the question is off.
>>
>>
>> There is not really a reference from a hash value to an actorRef. The 
>> actors that build up the pool of the router live on a logical ring, and the 
>> messages you send to the pool gets mapped (via hash values) onto that ring, 
>> ending up at some actor. If you send in messages that have the same hash 
>> value, they will go to the same actor. Actors don't get assigned to 
>> requests, but the requests get sent to the actors and ends up in the actors 
>> mailbox. Once the actor is finished with processing a message (request) 
>> then it takes the next message from its mailbox.
>>
>> Hope that helps.
>>
>> B/
>>
>> Thanks
>> Meena
>>
>> On Wednesday, March 26, 2014 10:19:53 AM UTC-4, drewhk wrote: 
>>>
>>> Hi, 
>>>
>>>
>>> On Wed, Mar 26, 2014 at 3:15 PM, MV <[email protected]> wrote:
>>>
>>>> Hi Andre, 
>>>>
>>>> Thanks a lot for getting back to me. Yes your understanding of my 
>>>> problem is correct. Can I google for more information on 
>>>> ConsistentHashingPool and how to use it?
>>>> I will also look into CustomRouter and let you know how that works out.
>>>>  
>>>
>>> It is on the same documentation page I linked: 
>>> http://doc.akka.io/docs/akka/2.3.1/scala/routing.html#ConsistentHashingPool_and_ConsistentHashingGroup
>>>
>>> -Endre
>>>  
>>>
>>>>  
>>>> Thanks
>>>> MV 
>>>>
>>>>
>>>> On Wednesday, March 26, 2014 8:39:57 AM UTC-4, Akka Team wrote:
>>>>
>>>>>   Hi MV,
>>>>>
>>>>> I don't see how Agents would help here. Your problem is basically that 
>>>>> the three messages for the same ID should be processed by the same Result 
>>>>> Processor. You can use ConsistentHashingPool or Group for that (assuming 
>>>>> Akka 2.3.x). If you need more specific domain dependent routing that is 
>>>>> not 
>>>>> expressible by consistent hashing you can implement your own routing 
>>>>> logic: 
>>>>> http://doc.akka.io/docs/akka/2.3.1/scala/routing.html#Custom_Router
>>>>>
>>>>> -Endre
>>>>>  
>>>>>
>>>>>  On Wed, Mar 26, 2014 at 12:40 AM, MV <[email protected]> wrote:
>>>>>
>>>>>>  Hi, 
>>>>>>
>>>>>> I have a specific question regarding Akka Agent.
>>>>>>
>>>>>> My scenario is as follows:
>>>>>>  
>>>>>>    1. I have 3 different Akka RoundRobin Workers. For example 3 
>>>>>>    Request Processors, 3 Workers(Database Worker) that connect to a 
>>>>>> database 
>>>>>>    and 3 workers (Result Processor) which received the database results 
>>>>>> and 
>>>>>>    process the results into some kind of count table for analysis. 
>>>>>>    2. The reason I have 3 of each is that, for simulation purposes, 
>>>>>>    assume 3 requests come in from the outside world into this system and 
>>>>>> each 
>>>>>>    worker handles a request. 
>>>>>>
>>>>>> My Issue:
>>>>>>  
>>>>>> Assume that 1 (ONE) Database worker can send upto 3 or 4 data tables 
>>>>>> for a specified time slice to the Result Processor(s).
>>>>>> The result processors have to:
>>>>>>  
>>>>>>    - From the first data ID result, create a table with some count 
>>>>>>    in it. 
>>>>>>    - When a second data result comes FOR THE SAME data ID update the 
>>>>>>    SHARED count table. 
>>>>>>    - When a third data result comes FOR THE SAME data ID, update the 
>>>>>>    SHARED count table again 
>>>>>>
>>>>>> The problem is that since DatabaseWorker is a worker of 3 instance, 
>>>>>> they can simultaneously process 3 Data Points (ID =1, ID = 2, ID =3)
>>>>>>  Since each Data Pont (ID =1 ) can produce more than 1 Result (R=1, 
>>>>>> R=2, R=3…), The Result Processor actor not only need to share the count 
>>>>>> table for each Data ID but also be able to handle all the ID's correctly 
>>>>>> and update the shared location for that SPECIFIC ID.
>>>>>>
>>>>>> How can I achieve this with AKKA Agent? Or is there another technique 
>>>>>> to handle this in Akka?
>>>>>>
>>>>>> Thanks in advance,
>>>>>> MV
>>>>>>  --
>>>>>> >>>>>>>>>> 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 [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/d/optout.
>>>>>>  
>>>>>  
>>>>>
>>>>>
>>>>> --
>>>>> Akka Team
>>>>> Typesafe - The software stack for applications that scale
>>>>> Blog: letitcrash.com
>>>>> Twitter: @akkateam
>>>>>  
>>>>   --
>>>> >>>>>>>>>> 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 [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/d/optout.
>>>>  
>>>  
>>>   --
>> >>>>>>>>>> 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 [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/d/optout.
>>
>> -- 
>> *Björn Antonsson*
>> Typesafe <http://typesafe.com/> – Reactive<http://reactivemanifesto.org/> 
>> Apps 
>> on the JVM
>> twitter: @bantonsson <http://twitter.com/#!/bantonsson>
>>
>> JOIN US. REGISTER TODAY! <http://www.scaladays.org/>
>> Scala <http://www.scaladays.org/>
>> Days <http://www.scaladays.org/>
>> June 16th-18th, <http://www.scaladays.org/>
>> Berlin <http://www.scaladays.org/>
>>
>>

-- 
>>>>>>>>>>      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 [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/d/optout.

Reply via email to