Re: [akka-user] cluster sharding failover
Hi again, I have found the problem and have a solution. Ticket herehttps://www.assembla.com/spaces/akka/tickets/3880. Pull request tomorrow. /Patrik On Tue, Feb 18, 2014 at 2:57 PM, Patrik Nordwall patrik.nordw...@gmail.comwrote: Hi James, Thanks for reporting. I'm still investigating your scenario. On the way I found another (maybe related) issuehttps://www.assembla.com/spaces/akka/tickets/3879 . Stay tuned. Regards Patrik On Tue, Feb 18, 2014 at 12:58 AM, James Bellenger ja...@kixeye.comwrote: Hi gang, a question regarding shard failover Here's my 3-node setup (using akka-2.3.0 rc3): - backend 1 - backend 2 - frontend All nodes initialize ClusterSharding at startup -- frontend supplies an empty entryProps so that it does not host any regions. Frontend starts pinging a range of sharded actors host on the backends -- I can see that the entries are evenly distributed across the backends. When I invoke a clean shutdown of one of the backends, the frontend node is left in a bad state. It continually tries to connect to the dead backend node. It does this forever. Restarting the frontend is required to get it to find the failed over shards on the remaining backend. Am I missing something with shutting down cluster sharding? Some logs from frontend. They're a bit noisy -- I've tried to call out the interesting bits. DEBUG 15:40:42,389 akka.contrib.pattern.ShardRegion - Forwarding request for shard [0] to [Actor[akka.tcp:// ghost@127.0.0.1:50351/user/sharding/user#-576014717]] DEBUG 15:40:43,405 akka.contrib.pattern.ShardRegion - Forwarding request for shard [1] to [Actor[akka.tcp:// ghost@127.0.0.1:50324/user/sharding/user#-498786510]] DEBUG 15:40:44,425 akka.contrib.pattern.ShardRegion - Forwarding request for shard [2] to [Actor[akka.tcp:// ghost@127.0.0.1:50351/user/sharding/user#-576014717]] INFO 15:40:44,825 akka.actor.LocalActorRef - Message [akka.remote.transport.AssociationHandle$Disassociated] from Actor[akka://ghost/deadLetters] to Actor[akka://ghost/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fghost%40127.0.0.1%3A50351-1#-206867083] was not delivered. [2] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. INFO 15:40:44,881 akka.actor.LocalActorRef - Message [akka.remote.transport.ActorTransportAdapter$DisassociateUnderlying] from Actor[akka://ghost/deadLetters] to Actor[akka://ghost/system/transports/akkaprotocolmanager.tcp0/akkaProtocol-tcp%3A%2F%2Fghost%40127.0.0.1%3A50351-1#-206867083] was not delivered. [3] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. *DEBUG 15:40:44,884 akka.remote.EndpointWriter - Disassociated [akka.tcp://ghost@127.0.0.1:50373 http://ghost@127.0.0.1:50373] - [akka.tcp://ghost@127.0.0.1:50351 http://ghost@127.0.0.1:50351]* INFO 15:40:44,884 akka.actor.LocalActorRef - Message [akka.actor.FSM$Timer] from Actor[akka://ghost/deadLetters] to Actor[akka://ghost/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2Fghost%40127.0.0.1%3A50351-1/endpointWriter#1517188237] was not delivered. [4] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. INFO 15:40:45,091 akka.remote.RemoteActorRefProvider$RemoteDeadLetterActorRef - Message [akka.cluster.GossipEnvelope] from Actor[akka://ghost/system/cluster/core/daemon#-1507678631] to Actor[akka://ghost/deadLetters] was not delivered. [5] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. INFO 15:40:45,097 com.kixeye.common.log.AkkaLogger - Cluster Node [akka.tcp://ghost@127.0.0.1:50373] - Marking exiting node(s) as UNREACHABLE [Member(address = akka.tcp://ghost@127.0.0.1:50351, status = Exiting)]. This is expected and they will be removed. *INFO 15:40:45,106 com.kixeye.common.cluster.ClusterModule - member is unreachable: Member(address = akka.tcp://ghost@127.0.0.1:50351 http://ghost@127.0.0.1:50351, status = Exiting)* ^-- node becomes unreachable DEBUG 15:40:45,445 akka.contrib.pattern.ShardRegion - Forwarding request for shard [3] to [Actor[akka.tcp:// ghost@127.0.0.1:50324/user/sharding/user#-498786510]] INFO 15:40:45,535 akka.remote.RemoteActorRefProvider$RemoteDeadLetterActorRef - Message [akka.cluster.ClusterHeartbeatSender$Heartbeat] from Actor[akka://ghost/system/cluster/core/daemon/heartbeatSender#214131267] to Actor[akka://ghost/deadLetters] was not delivered. [6] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'. *DEBUG
[akka-user] Case studies, Recommendations, Experiences with Live Load Distribution?
Greetings, I am new to Akka and I am looking for articles, case studies or just user experiences with distribution of live load and how to handle it. Are there patterns that are accepted or tech in Akka to help out? Basically the use case is as follows: I am developing a system that will run to handle hundreds, or thousands of concurrent users. The system will need to distribute the load around the hardware and that distribution should be transparent to the users. The users will be connected to stateful actors with TCP connections and as the need dictates those actors may be moved to different remote systems to balance load. So the idea is Client Conntects, Does some transactions and received event stream, after some period of time the system determines the load has to shift to another machine and wants to move that actor to a different machine. The user goes about doing their transactions blissfully unaware that anything happened. In addition for security reasons, the system should require as few ports open through firewalls as possible but still support thousands of connections. Can anyone help out with some information on accepted practices or is this something i will have to brew up myself (perhaps sending event to reconnect to a different actor to the client and then so on). Thanks in advance. -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
[akka-user] akka.persistence, snapshots and deleting messages from journal
I would assume that a common scenario is to periodically snapshot state and keep 1 or more snapshots. In this case, I assume that as you delete older snapshots, you would also delete messages older than the snapshot from the journal in order to keep the journal from growing indefinitely. Is this a typical usage or am I missing something? I don't see anything in the code that automatically does this (and I didn't really expect to given the general flexibility theme of the framework). However, I don't see anything in the documentation that alludes to any other use of deleteMessage other than in dealing with exceptions. -david -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
[akka-user] Re: Actor Polymorphism
Hello Peter, One idea you might give a spin is to extract actor behaviors into traits, and compose behavior of a concrete actor using those. This can work because `receive` is basically just a `PartialFunction[Any, Unit]`, and those have a nice method called `PartialFunction#orElse(PartialFunction): PartialFunction` In code it might look something like this: ``` trait ProducerBehavior { this: Actor = val producerBehavior: Receive = { ... } } trait ConsumerBehavior { this: Actor = val consumerBehavior: Receive = { ... } } class PActor extends Actor with ProducerBehavior { def receive = producerBehavior } class CActor extends Actor with ConsumerBehavior { def receive = consumerBehavior } class PCActor extends Actor with ProducerBehavior with ConsumerBehavior { def receive = producerBehavior orElse consumerBehavior } ``` Not sure about your precise use-case, but code wise, using this you're able to duplicate as little as possible :-) -- Konrad http://geecon.org W dniu wtorek, 18 lutego 2014 20:33:23 UTC użytkownik Peter Wolf napisał: Hello, there must be a document or tutorial about this somewhere, but I can't find it... How do Actors implement message polymorphism? I want to make a system where some Actors are Producers, some are Consumers and some are both Producers and Consumers My actual code is more complicated, so here is a stripped down version to concentrate on my question Producers accept the message GimmeStuff and respond by sending Stuff. Consumers send the message GimmeStuff and accept Stuff Here they are abstract class Producer[WORK] extends Actor { def receive = { case GimmeStuff = if(stuffAvailable) sender ! Stuff(nextStuff) abstract class Consumer[WORK] extends Actor { def receive = { case Stuff(stuff) = doStuff(stuff) sender ! GImmeStuff How do I implement ProducerAndConsumer without duplicating the receive code? Thanks P -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
Re: [akka-user] Re: Actor Polymorphism
Thanks Konrad. This pattern is somehow documented here: http://doc.akka.io/docs/akka/snapshot/scala/actors.html#Extending_Actors_using_PartialFunction_chaining Could perhaps be improved though. On Tue, Feb 18, 2014 at 9:52 PM, Konrad Malawski ktos...@gmail.com wrote: Hello Peter, One idea you might give a spin is to extract actor behaviors into traits, and compose behavior of a concrete actor using those. This can work because `receive` is basically just a `PartialFunction[Any, Unit]`, and those have a nice method called `PartialFunction#orElse(PartialFunction): PartialFunction` In code it might look something like this: ``` trait ProducerBehavior { this: Actor = val producerBehavior: Receive = { ... } } trait ConsumerBehavior { this: Actor = val consumerBehavior: Receive = { ... } } class PActor extends Actor with ProducerBehavior { def receive = producerBehavior } class CActor extends Actor with ConsumerBehavior { def receive = consumerBehavior } class PCActor extends Actor with ProducerBehavior with ConsumerBehavior { def receive = producerBehavior orElse consumerBehavior } ``` Not sure about your precise use-case, but code wise, using this you're able to duplicate as little as possible :-) -- Konrad http://geecon.org W dniu wtorek, 18 lutego 2014 20:33:23 UTC użytkownik Peter Wolf napisał: Hello, there must be a document or tutorial about this somewhere, but I can't find it... How do Actors implement message polymorphism? I want to make a system where some Actors are Producers, some are Consumers and some are both Producers and Consumers My actual code is more complicated, so here is a stripped down version to concentrate on my question Producers accept the message GimmeStuff and respond by sending Stuff. Consumers send the message GimmeStuff and accept Stuff Here they are abstract class Producer[WORK] extends Actor { def receive = { case GimmeStuff = if(stuffAvailable) sender ! Stuff(nextStuff) abstract class Consumer[WORK] extends Actor { def receive = { case Stuff(stuff) = doStuff(stuff) sender ! GImmeStuff How do I implement ProducerAndConsumer without duplicating the receive code? Thanks P -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out. -- *Jonas Bonér*Phone: +46 733 777 123 Home: jonasboner.com Twitter: @jboner https://twitter.com/jboner -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
[akka-user] Re: Actor Polymorphism
Thank you Konrad. That's perfect. I was afraid that I'd asked a dumb obvious question. But I'm glad, I did because I would not have found that on my own -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
Re: [akka-user] Re: Actor Polymorphism
There's far less dumb questions than there are dumb answers :-) @Jonas: Cool! Perhaps an example like the above would showcase the feature better - will think about a simple PR for it :-) -- Cheers, Konrad Malawski blog.project13.pl | java.pl | geecon.org | gdgkrakow.pl | krakowscala.pl 2014-02-18 21:46 GMT+00:00 Peter Wolf opus...@gmail.com: Thank you Konrad. That's perfect. I was afraid that I'd asked a dumb obvious question. But I'm glad, I did because I would not have found that on my own -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out. -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
[akka-user] Passing a reference of LookupServiceImpl into an Untyped Actor and then publish the message to the subscribers
Hi, I am trying to look into the EventBus functionality in Akka and I started off with looking at the documentation provided. I started with - http://doc.akka.io/docs/akka/2.3.0-RC3/java/event-bus.html#Lookup_Classification I extended the base class as stated in the example and I was able to subscribe actors to the EventBus and was able to publish messages to various subscribers. The issue came in when I passed the reference of the LookupServiceImpl to an Actor class via its constructor. *All I was trying to achieve is to write an Actor which would publish the message it receives to the EventBus Implementation.* My Actor is the following : public class EventActor extends UntypedActor { private LookupEventBus eventBus; public EventActor() { } public EventActor(LookupEventBus eventBus) { this.eventBus = eventBus; System.out.println(TEST+eventBus.toString()); System.out.println(TEST+eventBus.mapSize()); } @Override public void onReceive(Object message) throws Exception { // TODO Auto-generated method stub //System.out.println(RegistrationEventActor ::+message); //eventBus.publish(message); if(message instanceof TestEvent) { System.out.println(RegistrationEventActor ::+message); //System.out.println(Test:+eventBus.); /*if(eventBus instanceof LookupBusImpl) { ((LookupBusImpl)eventBus).publish((TestEvent)message); }*/ eventBus.publish((TestEvent)message); //ActorSelection registrationEventOuboundActor = } } } My JUnit Test case is the following : public void testAkkaLookupBusImpl() { //Subscriber could be on another JVM final ActorSystem outboundActorSystem = ActorSystem.create( OutboundSubscriberActorSystem); final ActorRef eventOutboundActor = outboundActorSystem.actorOf(Props.create(RegistrationEventOutboundActor. class),EventOuboundActor); final ActorRef basicOutboundActor = outboundActorSystem.actorOf(Props.create(BasicRegistrationEventOutboundActor. class),BasicEventOuboundActor); //LookupBusImpl is same as given in the Akka example documentation. LookupBusImpl lookUpBusEvent = new LookupBusImpl(); lookUpBusEvent.subscribe(eventOutboundActor, Event); lookUpBusEvent.subscribe(basicOutboundActor, Event); System.out.println(lookUpBusEvent.toString()); System.out.println(Map Size:+lookUpBusEvent.mapSize()); //Event Generation Actor System final ActorSystem eventGenerationActorSystem = ActorSystem.create( EventGenerationActorSystem); final ActorRef eventActor = eventGenerationActorSystem.actorOf(Props.create(EventActor.class, lookUpBusEvent),Event); System.out.println(Event Generation Path::+ eventActor.path()); final TestEvent test = new TestEvent(Event, 1); eventActor.tell(test,ActorRef.noSender()); } When the eventActor.tell(test,ActorRef.noSender()) is invoked , a message is sent to the Actor , but the message is not published to the Subscribers. Is there something that I am doing which is not correct ? Or is the EventBus not to be combined inside an Actor model ?? Can someone please throw some light on this ? Thanks in Advance, Sree. -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
[akka-user] Confusion about [default dispatcher]
Hi All, I've search sites a bit for help sloveing my confusion, but haven't found anything very clear. So I tought I'd post my problems and see if anyone could shed some light. I hava a question about the number of default-dispatcher created by the actor system. I have read that default-dispatcher would be shared by all of the actors in th system, so does it mean that only one default-dispatcher would be created when the actor-system is started? I am using the default-dispatcher and I found that it seems that multiple default-dispathcer are created on my machine. But I do not know why some many default-dispatchers are created. I also use RoundRobinPool is my programs, I was wounding if those dispatchers are created by that. The following is the thread information got from JVM 0x7f2574012800 JavaThread RunnerSystem-akka.actor.default-dispatcher-16 [_thread_in_native, id=4516, stack(0x7f25c915b000,0x7f25c925c000)] 0x7f2560001000 JavaThread RunnerSystem-akka.actor.default-dispatcher-15 [_thread_in_native, id=4515, stack(0x7f25c925c000,0x7f25c935d000)] 0x7f2574010800 JavaThread RunnerSystem-akka.actor.default-dispatcher-14 [_thread_blocked, id=4514, stack(0x7f25c935d000,0x7f25c945e000)] 0x7f255c001000 JavaThread RunnerSystem-akka.actor.default-dispatcher-13 [_thread_in_native, id=4513, stack(0x7f25c945e000,0x7f25c955f000)] 0x7f257400e800 JavaThread RunnerSystem-akka.actor.default-dispatcher-12 [_thread_in_native, id=4512, stack(0x7f25c955f000,0x7f25c966)] 0x7f2568001000 JavaThread RunnerSystem-akka.actor.default-dispatcher-11 [_thread_in_native, id=4511, stack(0x7f25c966,0x7f25c9761000)] 0x7f257400c800 JavaThread RunnerSystem-akka.actor.default-dispatcher-10 [_thread_blocked, id=4510, stack(0x7f25c9761000,0x7f25c9862000)] 0x7f257400a800 JavaThread RunnerSystem-akka.actor.default-dispatcher-9 [_thread_in_native, id=4509, stack(0x7f25c9862000,0x7f25c9963000)] 0x7f2574009000 JavaThread RunnerSystem-akka.actor.default-dispatcher-8 [_thread_blocked, id=4508, stack(0x7f25c9963000,0x7f25c9a64000)] 0x7f2574007800 JavaThread RunnerSystem-akka.actor.default-dispatcher-7 [_thread_in_native, id=4504, stack(0x7f25c9a64000,0x7f25c9b65000)] 0x7f2574004000 JavaThread RunnerSystem-akka.actor.default-dispatcher-6 [_thread_blocked, id=4503, stack(0x7f25c9b65000,0x7f25c9c66000)] 0x7f2580001000 JavaThread RunnerSystem-akka.actor.default-dispatcher-5 [_thread_in_native, id=4501, stack(0x7f25c9c66000,0x7f25c9d67000)] 0x7f261429d800 JavaThread RunnerSystem-akka.actor.default-dispatcher-4 [_thread_blocked, id=4500, stack(0x7f25c9d67000,0x7f25c9e68000)] 0x7f261440b800 JavaThread RunnerSystem-akka.actor.default-dispatcher-3 [_thread_blocked, id=4499, stack(0x7f25c9e68000,0x7f25c9f69000)] 0x7f2614279000 JavaThread RunnerSystem-akka.actor.default-dispatcher-2 [_thread_in_native, id=4498, stack(0x7f25c9f69000,0x7f25ca06a000)] Thank you very much -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
Re: [akka-user] akka.persistence, snapshots and deleting messages from journal
You can use deleteMessages to delete all messages up to a specified sequence number. I would not use it too eagerly, since the information in the history can be valuable in itself, but that is of course depending on the application. /Patrik On Tue, Feb 18, 2014 at 9:39 PM, dpenn...@good-cloud.com wrote: I would assume that a common scenario is to periodically snapshot state and keep 1 or more snapshots. In this case, I assume that as you delete older snapshots, you would also delete messages older than the snapshot from the journal in order to keep the journal from growing indefinitely. Is this a typical usage or am I missing something? I don't see anything in the code that automatically does this (and I didn't really expect to given the general flexibility theme of the framework). However, I don't see anything in the documentation that alludes to any other use of deleteMessage other than in dealing with exceptions. -david -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out. -- Patrik Nordwall Typesafe http://typesafe.com/ - Reactive apps on the JVM Twitter: @patriknw -- 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.