Questions about Cluster Aware Router

271 views
Skip to first unread message

Mainak Ghosh

unread,
May 30, 2017, 4:37:01 PM5/30/17
to Akka User List
Hello,

I am recently playing around with cluster aware routers and distributed data and I have a few questions. I extended the multi jvm test code ReplicatedCacheSpec to create a cluster aware router which creates a pool of ReplicatedCache worker routees. Here is the code: https://gist.github.com/mghosh4/55f96a7402960923c528ea69a103c5af

When I try running this code: I get the following exception:

Failed to serialize remote message [class akka.actor.ActorSelectionMessage] using serializer [class akka.remote.serialization.MessageContainerSerializer]. Transient association error (association remains live)
[JVM-1]         at akka.remote.MessageSerializer$.serialize(MessageSerializer.scala:62)
[JVM-1]         at akka.remote.EndpointWriter.$anonfun$serializeMessage$1(Endpoint.scala:895)
[JVM-1]         at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[JVM-1]         at akka.remote.EndpointWriter.serializeMessage(Endpoint.scala:895)
[JVM-1]         at akka.remote.EndpointWriter.writeSend(Endpoint.scala:786)
[JVM-1]         at akka.remote.EndpointWriter$$anonfun$4.applyOrElse(Endpoint.scala:761)
[JVM-1]         at akka.actor.Actor.aroundReceive(Actor.scala:513)
[JVM-1]         at akka.actor.Actor.aroundReceive$(Actor.scala:511)
[JVM-1]         at akka.remote.EndpointActor.aroundReceive(Endpoint.scala:452)
[JVM-1]         at akka.actor.ActorCell.receiveMessage(ActorCell.scala:519)
[JVM-1]         at akka.actor.ActorCell.invoke(ActorCell.scala:488)
[JVM-1]         at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
[JVM-1]         at akka.dispatch.Mailbox.run(Mailbox.scala:224)
[JVM-1]         at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
[JVM-1]         at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
[JVM-1]         at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
[JVM-1]         at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
[JVM-1]         at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
[JVM-1] Caused by: java.io.NotSerializableException: No configured serialization-bindings for class [sample.distributeddata.ReplicatedCache$PutInCache]
[JVM-1]         at akka.serialization.Serialization.serializerFor(Serialization.scala:235)
[JVM-1]         at akka.serialization.Serialization.findSerializerFor(Serialization.scala:211)
[JVM-1]         at akka.remote.serialization.MessageContainerSerializer.serializeSelection(MessageContainerSerializer.scala:35)

When I change line 83 in the gist from 

context.actorOf(FromConfig.props(ReplicatedCache.props()), name = "replicatedCache")

to

context.actorOf(ReplicatedCache.props), name = "replicatedCache")

this error goes away. Is there something that I do not understand?

Finally, I tried adding a resizer block in the configuration. I saw an exception saying something like resizer and cluster block cannot work together. Is that a current limitation?

Thanks,
Mainak

Akka Team

unread,
Jun 7, 2017, 7:33:49 AM6/7/17
to Akka User List
The error message says that you have not configured serialization for the message sample.distributeddata.ReplicatedCache.PutInCache which something tries to send between nodes.

--
Johan
Akka Team

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

Patrik Nordwall

unread,
Jun 7, 2017, 7:40:11 AM6/7/17
to akka...@googlegroups.com
Note that the intention is to use the local `Replicator` so there is not much point in delegating the message with a router to remote node, unless you use nodes with different roles, such as "frontend" and "backend" and only run distributed data on the "backend" nodes and want to send the messages from the "frontend" to the "backend" with the routers. That is probably what you are trying to do and then you must have serialization for that message.

/Patrik
--

Patrik Nordwall
Akka Tech Lead
Lightbend -  Reactive apps on the JVM
Twitter: @patriknw

Mainak Ghosh

unread,
Jun 7, 2017, 11:20:37 AM6/7/17
to akka...@googlegroups.com
Hello Patrik and Johan,

Thanks for your reply. The goal of my work is to test the performance of resizer block in a cluster aware situation where the routees are replicators who are trying to reconcile state among themselves based on application's consistency requirement. Can you please shed some light on whether I can do this in Akka?

Here is what I have done so far. Resizers do not work with group routers. So I am using pool routers for this. I am using StatsSampleSingleMasterSpec as an example of pool based cluster aware router. I have hooked up the ReplicatedCache actor as a routee. Now I wanted to add the resizer block and it threw me an error that resizer block cannot be used along side cluster block. Can I do it programmatically or is this a limitation?

Mainak

You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/6QE7iFL3IHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Mainak Ghosh



Patrik Nordwall

unread,
Jun 8, 2017, 3:59:44 AM6/8/17
to akka...@googlegroups.com
I think resizer is only for local router. Also, I don't understand why adding more actors should improve performance if the bottleneck is outside of these actors. Have you tried by just using the local replicator from each node without any routers. If not, please explain why that is not a good fit for your application.

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

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



--

Patrik Nordwall
Akka Tech Lead
Lightbend -  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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/6QE7iFL3IHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Mainak Ghosh



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

Mainak Ghosh

unread,
Jun 8, 2017, 2:13:00 PM6/8/17
to akka...@googlegroups.com
Hello Patrik,

I am trying to explore the tradeoffs of instantiating a new routee when there is overhead of state reconciliation. In my application, routees themselves can be CPU intensive, and as a result distributing the load across multiple machine improves performance (especially when we have a lower core count machines). Additionally, we are exploring the impact of controlled locality for remote actors.


Thanks,
Mainak


To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

--
>>>>>>>>>> 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+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--

Patrik Nordwall
Akka Tech Lead
Lightbend -  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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/6QE7iFL3IHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Mainak Ghosh



--
>>>>>>>>>> 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+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/6QE7iFL3IHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+unsubscribe@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Mainak Ghosh



Mainak Ghosh

unread,
Jun 14, 2017, 2:38:16 PM6/14/17
to akka...@googlegroups.com
Hello Patrik,

Any thoughts on this. We can setup a chat some time if that helps.

Mainak
--
Mainak Ghosh



Patrik Nordwall

unread,
Jun 15, 2017, 7:17:14 AM6/15/17
to akka...@googlegroups.com
I'd recommend Lightbend Proffesional Support for such design consulting. If you have found an issue or bottleneck in Akka you are welcome to continue the discussion here or in the issue tracker with a reproducer of the problem.

Thanks,
Patrik
Reply all
Reply to author
Forward
0 new messages