[akka-user] Re: Patterns.gracefulStop - This doesn't seem to work

2014-04-16 Thread Boney Sekh
Hi,

I thought I should add this. Basically this works when my TestActor is at 
the system level, i.e. system.actorOf. However what I am trying to do is to 
stop an actor *which is a child of another*. 

Thanks,
B

On Wednesday, April 16, 2014 1:55:59 PM UTC+8, Boney Sekh wrote:

 Hi,

 I have been trying to use the Patterns.gracefulStop to stop an actor 
 gracefully. I know my internal actor is stopped by verifying the postStop 
 method is invoked.
 However, the future is not returning true and is held until timeout.

 Is there a bug?

 Here is my code:

 public class TestActor extends UntypedActor {

 private final Logger log = LoggerFactory.getLogger(TestActor.class);

 final ActorRef target;

 public TestActor( ActorRef target ) {
 this.target = target;
 }

 @Override
 public void postStop() throws Exception {
 super.postStop();
 log.info(Actor stopped...);
 }

 @Override
 public void onReceive( Object msg ) {
 if ( msg == Command.STOP_PROCESSING ) {
 log.info(Stopping actor...);
 getContext().stop( getSelf() );
 } else {
 unhandled(msg);
 }
 }

 }

 Code to stop:

 Future Boolean  stopped = Patterns.gracefulStop( actorRef, 
 Duration.create( 5, TimeUnit.SECONDS ), Command.STOP_PROCESSING );
 Await.result( stopped, Duration.Inf() );


-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: Patterns.gracefulStop - This doesn't seem to work

2014-04-16 Thread √iktor Ҡlang
Hi Boney,

can you create a _minimized_ code sample that is self contained and shows
the perceived bug?


On Wed, Apr 16, 2014 at 10:59 AM, Boney Sekh boneys...@gmail.com wrote:

 Hi,

 I thought I should add this. Basically this works when my TestActor is at
 the system level, i.e. system.actorOf. However what I am trying to do is to
 stop an actor *which is a child of another*.

 Thanks,
 B


 On Wednesday, April 16, 2014 1:55:59 PM UTC+8, Boney Sekh wrote:

 Hi,

 I have been trying to use the Patterns.gracefulStop to stop an actor
 gracefully. I know my internal actor is stopped by verifying the postStop
 method is invoked.
 However, the future is not returning true and is held until timeout.

 Is there a bug?

 Here is my code:

 public class TestActor extends UntypedActor {

 private final Logger log = LoggerFactory.getLogger(TestActor.class);

 final ActorRef target;

 public TestActor( ActorRef target ) {
 this.target = target;
 }

 @Override
 public void postStop() throws Exception {
 super.postStop();
 log.info(Actor stopped...);
 }

 @Override
 public void onReceive( Object msg ) {
 if ( msg == Command.STOP_PROCESSING ) {
 log.info(Stopping actor...);
 getContext().stop( getSelf() );
 } else {
 unhandled(msg);
 }
 }

 }

 Code to stop:

 Future Boolean  stopped = Patterns.gracefulStop( actorRef,
 Duration.create( 5, TimeUnit.SECONDS ), Command.STOP_PROCESSING );
 Await.result( stopped, Duration.Inf() );

  --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: Patterns.gracefulStop - This doesn't seem to work

2014-04-16 Thread Boney Sekh
Hi Victor,

Thanks for your reply. While I was trying to create the sample, I realized 
the problem was that I was using TestActorRef and that was probably the 
reason. When I moved my test to using JavaTestKit, it worked fine. Your 
reply helped me to get to the problem and thanks for that.

Regards,
Boney

On Wednesday, April 16, 2014 5:24:52 PM UTC+8, √ wrote:

 Hi Boney,

 can you create a _minimized_ code sample that is self contained and shows 
 the perceived bug?


 On Wed, Apr 16, 2014 at 10:59 AM, Boney Sekh bone...@gmail.comjavascript:
  wrote:

 Hi,

 I thought I should add this. Basically this works when my TestActor is at 
 the system level, i.e. system.actorOf. However what I am trying to do is to 
 stop an actor *which is a child of another*. 

 Thanks,
 B


 On Wednesday, April 16, 2014 1:55:59 PM UTC+8, Boney Sekh wrote:

 Hi,

 I have been trying to use the Patterns.gracefulStop to stop an actor 
 gracefully. I know my internal actor is stopped by verifying the postStop 
 method is invoked.
 However, the future is not returning true and is held until timeout.

 Is there a bug?

 Here is my code:

 public class TestActor extends UntypedActor {

 private final Logger log = LoggerFactory.getLogger(TestActor.class);

 final ActorRef target;

 public TestActor( ActorRef target ) {
 this.target = target;
 }

 @Override
 public void postStop() throws Exception {
 super.postStop();
 log.info(Actor stopped...);
 }

 @Override
 public void onReceive( Object msg ) {
 if ( msg == Command.STOP_PROCESSING ) {
 log.info(Stopping actor...);
 getContext().stop( getSelf() );
 } else {
 unhandled(msg);
 }
 }

 }

 Code to stop:

 Future Boolean  stopped = Patterns.gracefulStop( actorRef, 
 Duration.create( 5, TimeUnit.SECONDS ), Command.STOP_PROCESSING );
 Await.result( stopped, Duration.Inf() );

  -- 
  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+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Cheers,
 √
  

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Akka actors not getting balanced thread time

2014-04-16 Thread Benjamin Black
I'm creating an application that HTTP streams data that is read from Kafka. 
A client can create multiple connections, with the data being evenly 
balanced between the connections. I'm using Spray 1.3.1 to handle the HTTP 
streaming and Akka 2.3.0. Each client connection creates a streamer actor 
that gets data from a reader actor that is unique to the client. For 
example, if a client connects four times, there will be four streamer 
actors, with the streamer actors all requesting data from one reader actor.

What I'm witnessing is the following behavior (all connections to the same 
process, using default dispatcher):

T0: 1st client connection, 1st streamer and reader created, streamer 
requests 1400 msgs per second from the reader
T1: 2nd client connection, 2nd streamer created, 1st streamer requesting 
600 msgs per second, 2nd streamer requesting 1200 msgs per second
T2: 1st client connection killed, 1st streamer killed, 2nd streamer 
requesting 1700 msgs per second
T3: 3rd client connection, 3rd streamer created, 2nd  3rd streamer each 
requesting 1000 per second (this is the behavior I want!)

Basically it would seem that the 1st streamer is not getting the same 
thread time as later streamers. Is this a crazy thought? Is there anything 
I check to make sure the akka system is setup correctly? If people think 
this could be an akka bug then I can try to put together a small code 
example that demonstrates this behavior. Thanks.

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka actors not getting balanced thread time

2014-04-16 Thread √iktor Ҡlang
Hi Benjamin,

your question is hypothetical and without the code and config etc it's
impossible to make a qualified answer.
What does your JVM monitoring tell you?


On Wed, Apr 16, 2014 at 7:47 PM, Benjamin Black benblac...@gmail.comwrote:

 I'm creating an application that HTTP streams data that is read from
 Kafka. A client can create multiple connections, with the data being evenly
 balanced between the connections. I'm using Spray 1.3.1 to handle the HTTP
 streaming and Akka 2.3.0. Each client connection creates a streamer actor
 that gets data from a reader actor that is unique to the client. For
 example, if a client connects four times, there will be four streamer
 actors, with the streamer actors all requesting data from one reader actor.

 What I'm witnessing is the following behavior (all connections to the same
 process, using default dispatcher):

 T0: 1st client connection, 1st streamer and reader created, streamer
 requests 1400 msgs per second from the reader
 T1: 2nd client connection, 2nd streamer created, 1st streamer requesting
 600 msgs per second, 2nd streamer requesting 1200 msgs per second
 T2: 1st client connection killed, 1st streamer killed, 2nd streamer
 requesting 1700 msgs per second
 T3: 3rd client connection, 3rd streamer created, 2nd  3rd streamer each
 requesting 1000 per second (this is the behavior I want!)

 Basically it would seem that the 1st streamer is not getting the same
 thread time as later streamers. Is this a crazy thought? Is there anything
 I check to make sure the akka system is setup correctly? If people think
 this could be an akka bug then I can try to put together a small code
 example that demonstrates this behavior. Thanks.

 --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] BalancingDispatcher Broadcast message bug.

2014-04-16 Thread vitaly tamazyan
When I try to tell a Broadcast message to routees with BalancingDispatcher, 
I get strange behavior -- some actors get the message twice, and some -- 
not at all.
Same thing happens if  I manually iterate through routee's  actorRefs and 
send a message directly to them. This I believe is not right. 
When I use another types of dispatchers, everything works as expected.
tested on akka 2.2.4, java 7, linux mint 16

See example code below:

public void test() {
ActorSystem system = ActorSystem.create(test);

Props routeeProps = 
Props.create(Worker.class).withDispatcher(akka.workerDispatcher);

ListActorRef routees = new ArrayList();

for (int i = 16; i  0; i--) {
ActorRef actor = system.actorOf(routeeProps, Worker + i);
routees.add(actor);
}

ActorRef workers = system.actorOf(
Props.empty().withRouter(RoundRobinRouter.create(routees)
.withDispatcher(akka.managerDispatcher)),Workers);

for (int i = 0; i  10; i++) {
workers.tell(new Broadcast(test + i), null);
}
}  


public class Worker extends UntypedActor {
private LoggingAdapter logger = 
Logging.getLogger(getContext().system().eventStream(), this);
private Random r = new Random();

@Override
public void onReceive(Object message) throws Exception {
logger.debug(getSelf().path().name() ++ message);
Thread.sleep(100 * r.nextInt(10)); // emulate load
}
}


*application.conf*

 akka {
 workerDispatcher {
   executor = thread-pool-executor
   type = BalancingDispatcher
   }

 managerDispatcher {
  executor = thread-pool-executor
  type = Dispatcher
  }

 loggers = [akka.event.slf4j.Slf4jLogger]
  loglevel=DEBUG

  log-dead-letters-during-shutdown = off
 }

*output:*
.
23:43:04.234 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker3 
 test9
23:43:04.333 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5 
 test9
23:43:04.334 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker1 
 test9
23:43:04.335 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker13 
 test9
23:43:04.336 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker9 
 test9
23:43:04.433 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker6 
 test9
23:43:04.434 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker7 
 test9
23:43:04.435 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker16 
 test9
*23:43:04.633 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
Worker14  test9*
23:43:04.637 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker4 
 test9
23:43:04.733 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5 
 test9
23:43:04.734 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker10 
 test9
23:43:04.735 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker1 
 test9
*23:43:04.736 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
Worker14  test9*
23:43:04.833 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5 
 test9



-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] BalancingDispatcher Broadcast message bug.

2014-04-16 Thread √iktor Ҡlang
Hi Vitaly,

Actors who have a BalancingDispatcher are sharing the same mailbox instance.
Your observed behavior is perfectly expected.


On Wed, Apr 16, 2014 at 11:00 PM, vitaly tamazyan vit@gmail.com wrote:

 When I try to tell a Broadcast message to routees with
 BalancingDispatcher, I get strange behavior -- some actors get the
 message twice, and some -- not at all.
 Same thing happens if  I manually iterate through routee's  actorRefs and
 send a message directly to them. This I believe is not right.
 When I use another types of dispatchers, everything works as expected.
 tested on akka 2.2.4, java 7, linux mint 16

 See example code below:

 public void test() {
 ActorSystem system = ActorSystem.create(test);

 Props routeeProps =
 Props.create(Worker.class).withDispatcher(akka.workerDispatcher);

 ListActorRef routees = new ArrayList();

 for (int i = 16; i  0; i--) {
 ActorRef actor = system.actorOf(routeeProps, Worker + i);
 routees.add(actor);
 }

 ActorRef workers = system.actorOf(
 Props.empty().withRouter(RoundRobinRouter.create(routees)
 .withDispatcher(akka.managerDispatcher)),Workers);

 for (int i = 0; i  10; i++) {
 workers.tell(new Broadcast(test + i), null);
 }
 }


 public class Worker extends UntypedActor {
 private LoggingAdapter logger =
 Logging.getLogger(getContext().system().eventStream(), this);
 private Random r = new Random();

 @Override
 public void onReceive(Object message) throws Exception {
 logger.debug(getSelf().path().name() ++ message);
 Thread.sleep(100 * r.nextInt(10)); // emulate load
 }
 }


 *application.conf*

  akka {
  workerDispatcher {
executor = thread-pool-executor
type = BalancingDispatcher
}

  managerDispatcher {
   executor = thread-pool-executor
   type = Dispatcher
   }

  loggers = [akka.event.slf4j.Slf4jLogger]
   loglevel=DEBUG

   log-dead-letters-during-shutdown = off
  }

 *output:*
 .
 23:43:04.234 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker3
  test9
 23:43:04.333 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5
  test9
 23:43:04.334 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker1
  test9
 23:43:04.335 [test-akka.actor.default-dispatcher-4] DEBUG Worker -
 Worker13  test9
 23:43:04.336 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker9
  test9
 23:43:04.433 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker6
  test9
 23:43:04.434 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker7
  test9
 23:43:04.435 [test-akka.actor.default-dispatcher-4] DEBUG Worker -
 Worker16  test9
 *23:43:04.633 [test-akka.actor.default-dispatcher-4] DEBUG Worker -
 Worker14  test9*
 23:43:04.637 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker4
  test9
 23:43:04.733 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5
  test9
 23:43:04.734 [test-akka.actor.default-dispatcher-4] DEBUG Worker -
 Worker10  test9
 23:43:04.735 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker1
  test9
 *23:43:04.736 [test-akka.actor.default-dispatcher-4] DEBUG Worker -
 Worker14  test9*
 23:43:04.833 [test-akka.actor.default-dispatcher-4] DEBUG Worker - Worker5
  test9



  --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] BalancingDispatcher Broadcast message bug.

2014-04-16 Thread vitaly tamazyan
Good point, thanks!
I think this corner case should be noted in the documentation on Broadcast 
messages, because now it says:
A Broadcast message can be used to send a message to *all* of a router's 
routees. 
When a router receives aBroadcast message, it will broadcast that message's 
*payload* to all routees, no matter how that router would normally route 
its messages.

It is hard to connect a problem with routing to the type of dispatcher.
 

четверг, 17 апреля 2014 г., 0:03:10 UTC+3 пользователь √ написал:

 Hi Vitaly,

 Actors who have a BalancingDispatcher are sharing the same mailbox 
 instance.
 Your observed behavior is perfectly expected.


 On Wed, Apr 16, 2014 at 11:00 PM, vitaly tamazyan 
 vit...@gmail.comjavascript:
  wrote:

 When I try to tell a Broadcast message to routees with 
 BalancingDispatcher, I get strange behavior -- some actors get the 
 message twice, and some -- not at all.
 Same thing happens if  I manually iterate through routee's  actorRefs and 
 send a message directly to them. This I believe is not right. 
 When I use another types of dispatchers, everything works as expected.
 tested on akka 2.2.4, java 7, linux mint 16

 See example code below:

 public void test() {
 ActorSystem system = ActorSystem.create(test);

 Props routeeProps = 
 Props.create(Worker.class).withDispatcher(akka.workerDispatcher);

 ListActorRef routees = new ArrayList();

 for (int i = 16; i  0; i--) {
 ActorRef actor = system.actorOf(routeeProps, Worker + i);
 routees.add(actor);
 }

 ActorRef workers = system.actorOf(
 Props.empty().withRouter(RoundRobinRouter.create(routees)
 .withDispatcher(akka.managerDispatcher)),Workers);

 for (int i = 0; i  10; i++) {
 workers.tell(new Broadcast(test + i), null);
 }
 }  


 public class Worker extends UntypedActor {
 private LoggingAdapter logger = 
 Logging.getLogger(getContext().system().eventStream(), this);
 private Random r = new Random();

 @Override
 public void onReceive(Object message) throws Exception {
 logger.debug(getSelf().path().name() ++ message);
 Thread.sleep(100 * r.nextInt(10)); // emulate load
 }
 }


 *application.conf*

  akka {
  workerDispatcher {
executor = thread-pool-executor
type = BalancingDispatcher
}

  managerDispatcher {
   executor = thread-pool-executor
   type = Dispatcher
   }

  loggers = [akka.event.slf4j.Slf4jLogger]
   loglevel=DEBUG

   log-dead-letters-during-shutdown = off
  }

 *output:*
 .
 23:43:04.234 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker3  test9
 23:43:04.333 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker5  test9
 23:43:04.334 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker1  test9
 23:43:04.335 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker13  test9
 23:43:04.336 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker9  test9
 23:43:04.433 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker6  test9
 23:43:04.434 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker7  test9
 23:43:04.435 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker16  test9
 *23:43:04.633 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker14  test9*
 23:43:04.637 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker4  test9
 23:43:04.733 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker5  test9
 23:43:04.734 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker10  test9
 23:43:04.735 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker1  test9
 *23:43:04.736 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker14  test9*
 23:43:04.833 [test-akka.actor.default-dispatcher-4] DEBUG Worker - 
 Worker5  test9



  -- 
  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+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Cheers,
 √
  

-- 
  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 

Re: [akka-user] Akka actors not getting balanced thread time

2014-04-16 Thread Benjamin Black
I'm working on reducing my code into something I can share. My system is 
actually a bit more complicated than I've explained. I'm using remote 
actors with other actors that coordinator everything and other actors that 
track offsets. I suppose I'm trying to understand how Akka allocates thread 
time to actors. The first streamer actor takes time to get up to full 
streaming speed, so maybe this affects the akka calculation? 

What kind of JVM monitoring are you referring to? I've used YourKit, but it 
didn't notice anything unusual.

On Wednesday, April 16, 2014 3:08:30 PM UTC-4, √ wrote:

 Hi Benjamin,

 your question is hypothetical and without the code and config etc it's 
 impossible to make a qualified answer.
 What does your JVM monitoring tell you?


 On Wed, Apr 16, 2014 at 7:47 PM, Benjamin Black 
 benbl...@gmail.comjavascript:
  wrote:

 I'm creating an application that HTTP streams data that is read from 
 Kafka. A client can create multiple connections, with the data being evenly 
 balanced between the connections. I'm using Spray 1.3.1 to handle the HTTP 
 streaming and Akka 2.3.0. Each client connection creates a streamer actor 
 that gets data from a reader actor that is unique to the client. For 
 example, if a client connects four times, there will be four streamer 
 actors, with the streamer actors all requesting data from one reader actor.

 What I'm witnessing is the following behavior (all connections to the 
 same process, using default dispatcher):

 T0: 1st client connection, 1st streamer and reader created, streamer 
 requests 1400 msgs per second from the reader
 T1: 2nd client connection, 2nd streamer created, 1st streamer requesting 
 600 msgs per second, 2nd streamer requesting 1200 msgs per second
 T2: 1st client connection killed, 1st streamer killed, 2nd streamer 
 requesting 1700 msgs per second
 T3: 3rd client connection, 3rd streamer created, 2nd  3rd streamer each 
 requesting 1000 per second (this is the behavior I want!)

 Basically it would seem that the 1st streamer is not getting the same 
 thread time as later streamers. Is this a crazy thought? Is there anything 
 I check to make sure the akka system is setup correctly? If people think 
 this could be an akka bug then I can try to put together a small code 
 example that demonstrates this behavior. Thanks.
  
 -- 
  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+...@googlegroups.com javascript:.
 To post to this group, send email to akka...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Cheers,
 √
  

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Akka actors not getting balanced thread time

2014-04-16 Thread √iktor Ҡlang
You tune fairness using the throughput setting on the dispatcher you are
using for your actors. 1 means it processes 1 message and then lets other
actors run, N == process up to N messages before handing back the thread to
the pool so other actors may run.

As for timeslice that's completely up to the OS to give the threads in the
pool time to run.


On Thu, Apr 17, 2014 at 12:56 AM, Benjamin Black benblac...@gmail.comwrote:

 I'm working on reducing my code into something I can share. My system is
 actually a bit more complicated than I've explained. I'm using remote
 actors with other actors that coordinator everything and other actors that
 track offsets. I suppose I'm trying to understand how Akka allocates thread
 time to actors. The first streamer actor takes time to get up to full
 streaming speed, so maybe this affects the akka calculation?

 What kind of JVM monitoring are you referring to? I've used YourKit, but
 it didn't notice anything unusual.


 On Wednesday, April 16, 2014 3:08:30 PM UTC-4, √ wrote:

 Hi Benjamin,

 your question is hypothetical and without the code and config etc it's
 impossible to make a qualified answer.
 What does your JVM monitoring tell you?


 On Wed, Apr 16, 2014 at 7:47 PM, Benjamin Black benbl...@gmail.comwrote:

 I'm creating an application that HTTP streams data that is read from
 Kafka. A client can create multiple connections, with the data being evenly
 balanced between the connections. I'm using Spray 1.3.1 to handle the HTTP
 streaming and Akka 2.3.0. Each client connection creates a streamer actor
 that gets data from a reader actor that is unique to the client. For
 example, if a client connects four times, there will be four streamer
 actors, with the streamer actors all requesting data from one reader actor.

 What I'm witnessing is the following behavior (all connections to the
 same process, using default dispatcher):

 T0: 1st client connection, 1st streamer and reader created, streamer
 requests 1400 msgs per second from the reader
 T1: 2nd client connection, 2nd streamer created, 1st streamer requesting
 600 msgs per second, 2nd streamer requesting 1200 msgs per second
 T2: 1st client connection killed, 1st streamer killed, 2nd streamer
 requesting 1700 msgs per second
 T3: 3rd client connection, 3rd streamer created, 2nd  3rd streamer each
 requesting 1000 per second (this is the behavior I want!)

 Basically it would seem that the 1st streamer is not getting the same
 thread time as later streamers. Is this a crazy thought? Is there anything
 I check to make sure the akka system is setup correctly? If people think
 this could be an akka bug then I can try to put together a small code
 example that demonstrates this behavior. Thanks.

 --
  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+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.

 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 --
 Cheers,
 √

  --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.