On Mon, Mar 24, 2014 at 8:33 PM, Michael Kohout <[email protected]> wrote:
> Hazzah! I look forward to updating to 2.3.1 :-) > > Thanks so much for your handholding through my stupid little problems > Mike > > You're welcome. Happy hakking! /Patrik > On Monday, March 24, 2014 2:00:00 PM UTC-5, Patrik Nordwall wrote: > >> >> >> >> On Mon, Mar 24, 2014 at 6:54 PM, Michael Kohout <[email protected]>wrote: >> >>> Hi Patrik- >>> >>> Yup, now it worked. I had to get the cluster seed nodes set up >>> correctly and then it looks like it works. >>> >> >> Glad to hear that. >> >> >>> >>> Next, I've got to create the proxy. Have Typesafe/other committers >>> considered adding a configurable proxy that could do this out of the box? >>> It seems like a common pattern. >>> >> >> It will be included in upcoming Akka 2.3.1, which will be released within >> a few days. :) >> >> >>> >>> Another thing you mentioned in the stack overflow it that the >>> SingletonManager picks the location of the singleton based on age and that >>> it will result in all actors being hosted on one box. Are there any common >>> ways people are distributing a number of singletons across a cluster? >>> >> >> You can define several cluster node roles and run the singletons on >> different roles. If you want something more dynamic that can make use of >> all nodes you can use Cluster >> Sharding<http://doc.akka.io/docs/akka/2.3.0/contrib/cluster-sharding.html> >> (introduced >> in v2.3.0). >> >> /Patrik >> >> >>> >>> thanks again >>> Mike >>> >>> >>> On Sunday, March 23, 2014 3:39:21 AM UTC-5, Patrik Nordwall wrote: >>> >>>> Hi Mike, >>>> >>>> >>>> On Fri, Mar 21, 2014 at 8:34 PM, Michael Kohout <[email protected]>wrote: >>>> >>>>> Hi All- >>>>> >>>>> This issue is a repost from a stack overflow >>>>> question<http://stackoverflow.com/questions/22547889/akka-actors-and-clustering-im-having-trouble-with-clustersingletonmanager-unha>I >>>>> currently have, but Patrik >>>>> Nordwall <http://stackoverflow.com/users/1835220/patrik-nordwall> >>>>> suggested >>>>> I post it here as well. >>>>> >>>>> Currently the system in prod uses only local actors. The basic >>>>> functionality of the app is that we have a bunch of actors that are each >>>>> responsible some work based on a range of hashed identifiers(hashed so >>>>> there is a fairly even distribution of work). A constraint with our >>>>> algorithm is that only one actor can work on that hash range at a time-so >>>>> some state in the actor is the starthash and the endhash. The application >>>>> is time based and every couple of minutes, we send a "WORK" message to >>>>> each >>>>> actor and based on the range they are responsible for they pull some data >>>>> out of a sql database and process it. While this may not be an optimal >>>>> architecture, this project is the first akka based project at this company >>>>> and we want to keep it simple. >>>>> >>>>> A new requirement is that we have to handle failover. I've been >>>>> prototyping using the ClusteredSingletonManager. It looks like the >>>>> simplest way to accomplish what I want-which is one actor across the >>>>> cluster that will be created/called per hash range. >>>>> >>>>> Here's the snippet of code that duplicates what I'm doing: >>>>> >>>>> ActorSystem system = ActorSystem.create("${applicat >>>>> ionName}-actor-system", clusterConfig) >>>>> >>>>> Props clusteredProps = >>>>> ClusterSingletonManager.defaultProps("worker".toString(), >>>>> PoisonPill.getInstance(), "workerSystem", >>>>> new ClusterSingletonPropsFactory(){ >>>>> >>>>> @Override >>>>> Props create(Object handOverData) { >>>>> log.info("called in >>>>> ClusterSingetonManager") >>>>> //WorkerActorCreator.create makes >>>>> a new Creator that'll wire up our newly created Actor with the spring >>>>> services it craves. >>>>> Props.create(WorkerActorCreato >>>>> r.create(applicationContext, it.start, it.end)).withDispatcher("akka. >>>>> actor.worker-dispatcher").withMailbox("akka.actor.single- >>>>> message-bound-mailbox") >>>>> } >>>>> } ) >>>>> ActorRef manager = system.actorOf(clusteredProps, >>>>> "worker-${it.start}-${it.end}".toString()) >>>>> >>>>> String path = manager.path().child("worker").toString() >>>>> >>>>> >>>>> //This should call my shiny new singleton worker? >>>>> system.actorSelection(path).tell(WORK) >>>>> >>>>> >>>>> >>>>> Is there something I'm doing wrong? Anything would be appreciated. >>>>> >>>> >>>> You have updated the names of the manager and the worker according to >>>> my proposal. What problem do you see now? >>>> >>>> That path should work on the oldest node, where the singleton worker is >>>> active. If you want to send messages to the singleton worker from other >>>> nodes you must implement a proxy actor that keeps track of where the oldest >>>> member is located. >>>> >>>> Note that it can take a while until the singleton becomes active when >>>> you startup a new system. >>>> >>>> /Patrik >>>> >>>> >>>>> >>>>> Mike >>>>> >>>>> >>>>> -- >>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c >>>>> urrent/additional/faq.html >>>>> >>>>>>>>>> Search the archives: https://groups.google.com/grou >>>>> p/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. >>>>> >>>> >>>> >>>> >>>> -- >>>> >>>> Patrik Nordwall >>>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >>>> Twitter: @patriknw >>>> >>>> -- >>> >>>>>>>>>> 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. >>> >> >> >> >> -- >> >> Patrik Nordwall >> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >> Twitter: @patriknw >> >> -- > >>>>>>>>>> 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. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> 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.
