Technical question about remoting and dependencies

40 views
Skip to first unread message

Björn Jacobs

unread,
Sep 6, 2013, 10:11:51 AM9/6/13
to akka...@googlegroups.com
Hallo everyone,

I just successfully used Akka remoting by setting up two separate ActorSystems and configured some Actors to be spawned on the remote, and the other Actors on the local ActorSystem. Everything working fine and I find it awesome how easy the setup was. :-)

I was wondering - on a technical level - how remoting of Actors is achieved?

When spawning a remote Actor, is my whole project being transferred over to the other host - with all dependencies in a big jar? Or does Akka select only relevant code for the Actor being spawned and transfers that?

Yours,
Björn

Björn Antonsson

unread,
Sep 6, 2013, 10:16:05 AM9/6/13
to akka...@googlegroups.com
Hi Björn,
No code is transferred. Only normal Scala/Java object serialization is done, and that assumes that the code exists on the remote machine as well.

B/ 
 
Yours,
Björn

--
>>>>>>>>>> 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+...@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/groups/opt_out.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

√iktor Ҡlang

unread,
Sep 6, 2013, 10:34:39 AM9/6/13
to Akka User List
"The actor class SampleActor has to be available to the runtimes using it, i.e. the classloader of the actor systems has to have a JAR containing the class."

:)

Cheers,
Viktor Klang
Director of Engineering

Twitter: @viktorklang

Björn Jacobs

unread,
Sep 6, 2013, 2:08:37 PM9/6/13
to akka...@googlegroups.com
Hallo Björn and Viktor!

Ah I see. So the reason it worked for me was that I put the code of my remote ActorSystem into the same project as the local ActorSystem - so that they share the same code base, right? Actually I didn't really execute it on a remote host but I started both ActorSystems locally in different processes.

So when I really want to start my remote ActorSystem on remote machine, I have to bundle my project first and store it there. That means that when developing, after each cycle I need to update the new classes onto the remote machine, right?

Yours,
Björn

Ryan Tanner

unread,
Sep 6, 2013, 9:52:15 PM9/6/13
to akka...@googlegroups.com
We solve this by using SBT subprojects and then having a very minimal "node" project using the Akka microkernel that reads in the cluster role for the given node and creates the top-level actor for the appropriate project.  The node project has the other subprojects as dependencies.

Essentially,

if(role.equals("analytics"))
  system.actorOf(Props.create(AnalyticsLeader.class), "analytics-leader");

We wind up having our entire code base on every node but that's a small price to pay in our opinion.  We just have to set the appropriate config parameter and that node spins up as whatever want.
Reply all
Reply to author
Forward
0 new messages