Hi,
We have a system where we in some cases mimic our backed services by just
creating some 'wait time'.
This to prove our own overhead is very low.
My colleague and I differ on the approach of the 'wait time'. I decided to
use the dealine approach as I used in the akka course (mimics the actor
doing some work). My colleague uses the system scheduler.
The effect should result in the same time measurements.
However we see that using the scheduler, the time is increase largely, on
our real system in stead of expected responses of about 60-70 ms, we get
80-90 ms.
This is reproducable with the code below.
Using the dealine approach we get:
stopping msg 1 took 202
stopping msg 4 took 201
stopping msg 2 took 203
stopping msg 5 took 201
stopping msg 3 took 203
stopping msg 6 took 201
stopping msg 7 took 201
stopping msg 8 took 200
stopping msg 9 took 200
stopping msg 10 took 201
Using the Scheduler we get:
stopping msg 4 took 217
stopping msg 3 took 220
stopping msg 7 took 216
stopping msg 8 took 218
stopping msg 9 took 218
stopping msg 2 took 219
stopping msg 5 took 219
stopping msg 1 took 220
stopping msg 6 took 220
stopping msg 10 took 222
So the difference roughly is the same as our real application.
Is it expected that the Scheduler performs the same, or is it the case the
scheduler has some overhead somewhere (what I am missing probably) why this
occurs?
tia,
regards,
Alex
Below our test that can be run against the scheduler or the dealine:
// the 'business' actor
class SimpleActor extends Actor {
val random = new scala.util.Random
override def receive = {
case m: SimpleMsg =>
quit(m)
}
def quit(m: SimpleMsg) = {
val delay = 200
val start = System.currentTimeMillis()
val deadLine = delay milliseconds fromNow
while (deadLine.hasTimeLeft()) {
// do some work...
}
val stopActor = context.actorOf(Props(new StopActor(sender, start)))
stopActor ! m
}
def quitScheduled(m: SimpleMsg) = {
context.system.scheduler.scheduleOnce(200 milliseconds,
context.actorOf(Props(new StopActor(sender, System.currentTimeMillis()))),
m)
}
}
// The stopactor
class StopActor(flowAc: ActorRef, start: Long) extends Actor {
override def receive = {
case msg: SimpleMsg =>
println("stopping msg " + msg.i + " took " +
(System.currentTimeMillis() - start))
flowAc ! Stop(msg.i)
self ! PoisonPill
}
}
--
>>>>>>>>>> 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.