title: Using Akka Actors/Remoting to distribute graph algorithms across a cluster
body: <p>So I'm currently working on distributing my Scala code across multiple machines for a large graph (<a href="https://stackoverflow.com/questions/9742938/efficiency-scalability-of-parallel-collections-in-scala-graphs">"part 1" of the question</a>) and am currently working with the Akka framework in the hopes of using Actors and Remoting.</p>
  
  <p>I read the document <a href="http://doc.akka.io/docs/akka/2.0/intro/getting-started-first-scala.html" rel="nofollow noreferrer">here</a> and it seems the way the example was done can be extended to do what I want to do, but I have a few concerns regarding this method...</p>
  
  <p>1) How do we decide how many instances of Actors we should create? Do we have to do a trial/error thing to see which is the best, or is there some more intuitive way to go about it?</p>
  
  <p>2) I am thinking of doing my task similarly to how the example was done - with a Master that spawns several Workers and communicate using case classes as messages. What I want to do is to find some metric between pairs of vertices (random walk), for all-pairs. I have a graph class that implements a method to calculate the metric given two vertices.</p>
  
  <p>I will give each Worker two vertices 'u' and 'v' to calculate the metric for, and have workers return the value.</p>
  
  <p>When the Master sends messages to Workers to calculate the metric, the Worker needs the graph structure - do I just do this by including the graph structure (i.e. adjacency list that is a HashMap) in the message? Will this cause any overhead by copying the graph structure each time, or do all workers just share that graph, or is there a better way to go about this?</p>
  
  <p>3) Does the algorithm for calculating the metric between pairs of vertices need to be re-implemented to the extended Actor class, or is there a way for individual Actors to access the same graph structure to call the method (I guess this is similar to the question above about passing the entire graph structure as part of the message)?</p>
  
  <p>Thanks!
  Regards,
  -kstruct</p>