Questions about using the Akka Microkernel for distributed graph processing

173 views
Skip to first unread message

adelbertc

unread,
Aug 4, 2012, 12:52:50 AM8/4/12
to akka...@googlegroups.com
So this is my current understanding of how the Microkernel would work in my situation:

1. I write a class containing the algorithm I wish to run (call this class ALG).
2. I compile ALG to a jar and put it in the /deploy/ directory.
3. I start (or restart) the Microkernel on each machine I want to distribute over, which will load up all jar's in the /deploy/ directory.
4. I send a message (a case class) to the Microkernel that contains ALG.
5. Microkernel deserializes, and loads up the appropriate class from the /deploy/ directory.

If this is correct, I have a few questions:

It looks like in the /bin/akka script, it takes only a class as an argument, but no arguments to create the class or anything. However, the way my distributed graph system works is that each machine will get at least 3 things:

a) it's own copy of the entire graph
b) the ALG class (once it deserializes the message)
c) a "slice" of the graph's vertices

I'm guessing these 3 will need to be sent via a message.

An example of part c would be distributing over 2 machines: Machine A and Machine B. The vertices of the graph are {1, 2, 3, 4}. Both machines get a copy of the entire graph, plus a slice. An example would be Machine A gets {1, 2} and Machine B gets {3, 4} and runs the algorithm on those vertices (these algorithm are "trivially parallelizable"). 

Without being able to pass arguments to the class, how would I handle sending the message for steps (a) (b) and (c)? Do I start a separate piece of code with a main() function that handles the vertex slicing and sends the appropriate messages to each machine, or is there a better, more Akka-style way of doing this?

Thanks!

√iktor Ҡlang

unread,
Aug 4, 2012, 7:58:50 AM8/4/12
to akka...@googlegroups.com
Hi,


Cheers,


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/3kt1VCMevrYJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Josh Marcus

unread,
Aug 4, 2012, 10:00:22 AM8/4/12
to akka...@googlegroups.com
Hi there,

We handle very similar situations in our Akka-based system (github.com/azavea/geotrellis) and are likely going to be integrating graph calculations in a few months.  I would say that your solution is fine, but the way I would handle it is a little different -- I would prefer to do less work on the "client" side (e.g. the separate piece of code with the vertex slicing that sends different messages to each machine) or more work on the "server" side.

The architecture I'd recommend is:
  • Create a case class that defines the entire operation over the entire graph.
  • Write a client code that sends that operation as a message to a coordinator (basically a server that responds to client requests).
  • The coordinator/server/etc. is then responsible for dividing up the single operation, e.g. doing vertex slicing, and generating the sub-operations.
  • The coordinator then sends off messages to all of its workers, which are the different machines -- or could even just be actors on the same machine, to parallelize the work on different cores.
  • The workers can be coordinators themselves, if need be.
  • The coordinator gets responses, reduces them to the output, and then returns the output to the client.
Somewhat related code is in our project here (with coordinators being called calculations):

While not necessary for your use-case, a very different approach to the whole distributed graph algorithm using actors can be found in this scala project, although my caveat is that I haven't used it myself: http://code.google.com/p/signal-collect/

Best,
--j

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/3kt1VCMevrYJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Josh Marcus
Senior GIS Software Architect

Azavea |  T: 215.701.7505
www.azavea.com

adelbertc

unread,
Aug 4, 2012, 5:42:02 PM8/4/12
to akka...@googlegroups.com
@Viktor: Thanks for the link - I did read that page, but was wondering if it is possible to get each Microkernel instance to read it's own local copy of the graph off the disk as opposed to getting a copy through an Actor message, since I don't want to be sending massive graphs over the network.

@Josh: Thanks for the tips, your proposed architecture is very interesting, I'm working off of it for my system - thanks!
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Viktor Klang

unread,
Aug 6, 2012, 5:04:26 AM8/6/12
to akka...@googlegroups.com
On Sat, Aug 4, 2012 at 11:42 PM, adelbertc <adel...@gmail.com> wrote:
> @Viktor: Thanks for the link - I did read that page, but was wondering if it
> is possible to get each Microkernel instance to read it's own local copy of
> the graph off the disk as opposed to getting a copy through an Actor
> message, since I don't want to be sending massive graphs over the network.

Yes of course, why wouldn't that be possible?

Cheers,

>>> akka-user+...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/akka-user?hl=en.
>>
>>
>>
>>
>> --
>> Josh Marcus
>> Senior GIS Software Architect
>>
>> Azavea | T: 215.701.7505
>> www.azavea.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/akka-user/-/O-h9Evj_Yl0J.
>
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+...@googlegroups.com.

adelbertc

unread,
Aug 7, 2012, 1:57:53 PM8/7/12
to akka...@googlegroups.com
If I'm understanding the page correctly, the recommended method of starting an instance of the Microkernel on each machine is using the akka script in the /bin/ folder of the Akka download, calling it as

bin/akka [class name]

Do I just add the parameters to the class in front of it? Say

class Foo(x: Int) extends Bootable { /* class definition here */ }

and call it as

bin/akka Foo 5

?
>>> For more options, visit this group at
>>> http://groups.google.com/group/akka-user?hl=en.
>>
>>
>>
>>
>> --
>> Josh Marcus
>> Senior GIS Software Architect
>>
>> Azavea |  T: 215.701.7505
>> www.azavea.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/akka-user/-/O-h9Evj_Yl0J.
>
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to

√iktor Ҡlang

unread,
Aug 7, 2012, 1:59:28 PM8/7/12
to akka...@googlegroups.com
On Tue, Aug 7, 2012 at 7:57 PM, adelbertc <adel...@gmail.com> wrote:
If I'm understanding the page correctly, the recommended method of starting an instance of the Microkernel on each machine is using the akka script in the /bin/ folder of the Akka download, calling it as

bin/akka [class name]

Do I just add the parameters to the class in front of it? Say

class Foo(x: Int) extends Bootable { /* class definition here */ }

and call it as

bin/akka Foo 5

To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/DLb6oB-WRNkJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--

Roland Kuhn

unread,
Aug 7, 2012, 2:35:04 PM8/7/12
to akka...@googlegroups.com
7 aug 2012 kl. 19:57 skrev adelbertc:

If I'm understanding the page correctly, the recommended method of starting an instance of the Microkernel on each machine is using the akka script in the /bin/ folder of the Akka download, calling it as

bin/akka [class name]

Do I just add the parameters to the class in front of it? Say

class Foo(x: Int) extends Bootable { /* class definition here */ }

and call it as

bin/akka Foo 5

?

No, Bootables are instantiated without arguments, see the example. If you want to pass data from the command line you can use any usual Java technique (system properties, environment variables, reading a config file, etc.).

Regards,

Roland

To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/DLb6oB-WRNkJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


√iktor Ҡlang

unread,
Aug 7, 2012, 2:50:03 PM8/7/12
to akka...@googlegroups.com
On Tue, Aug 7, 2012 at 8:35 PM, Roland Kuhn <goo...@rkuhn.info> wrote:

7 aug 2012 kl. 19:57 skrev adelbertc:

If I'm understanding the page correctly, the recommended method of starting an instance of the Microkernel on each machine is using the akka script in the /bin/ folder of the Akka download, calling it as

bin/akka [class name]

Do I just add the parameters to the class in front of it? Say

class Foo(x: Int) extends Bootable { /* class definition here */ }

and call it as

bin/akka Foo 5

?

No, Bootables are instantiated without arguments, see the example. If you want to pass data from the command line you can use any usual Java technique (system properties, environment variables, reading a config file, etc.).

Yes, so you'll need a 0-args constructor of your bootable. Put any logic in the startup/shutdown methods.

Cheers,



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Reply all
Reply to author
Forward
0 new messages