I have been able to isolate the code that is running differently between the two different actor providers. Below is the
receive of the offending actor:
var now: Long = _
def receive = {
case UserMessage.LookupOrgsResponse(_, uo) =>
now = new Date().getTime
db ! OrgMessage.BatchLookupByIds(uo.map( _.orgId ))
db ! PersonMessage.BatchLookupById(uo.map( _.personId ))
case OrgMessage.BatchLookupResponse(os) =>
println(s"orgs took ${new Date().getTime - now} ms")
orgs = Some(os); process
case PersonMessage.BatchLookupByIdResponse(ps) =>
println(s"persons took ${new Date().getTime - now} ms")
persons = Some(ps); process
}
When running with provider = "akka.remote.RemoteActorRefProvider", I get the following times:
persons took 15 ms
orgs took 57 ms
orgs took 13 ms
persons took 55 ms
orgs took 15 ms
persons took 57 ms
orgs took 19 ms
persons took 61 ms
orgs took 12 ms
persons took 52 ms
persons took 27 ms
orgs took 68 ms
orgs took 14 ms
persons took 55 ms
And when I run it with provider = "akka.cluster.ClusterActorRefProvider" I get:
orgs took 12 ms
persons took 14 ms
orgs took 15 ms
persons took 20 ms
persons took 13 ms
orgs took 15 ms
orgs took 12 ms
persons took 16 ms
orgs took 10 ms
persons took 12 ms
Again, nothing in the business logic is changing. I am simply changing the provider in the application.conf and making the routers cluster aware. These results are consistent on a warmed jvm.