On Mon, Oct 12, 2009 at 3:07 PM, Patrick Wright <pdou...@gmail.com> wrote:--vRem = Ref(new Location(myLocation.address, 9997), "test remote string");
Creates a ref with location = remote server, then serializes itself to
the remote server, saves the content of the ref on the remote server,
and continues executing on the remote server.
I'm not sure why just creating a ref with a remote location would
cause the transfer,So that is calling Ref.apply(location, value) defined on line 30 of Ref.scala. Note that on line 32 there is a call to Swarm.moveTo() - this is why the continuation moves to the remote server if location is non-local (of course, if location is the local node then Swarm.moveTo() has no effect).and why server A should be able to push data into
the Store in server B.You wouldn't, typically the decision to locate a piece of data on a remote server would be made automatically, perhaps for purposes of load-balancing.I do it manually in this demo just to demonstrate how the code will automatically be moved to the location of a Ref, because the stuff which would automatically move data around isn't implemented yet.Also, to what extent should Swarm expose or make clear operations
which may cause a move, and to what extent should it be hidden (though
possibly easier to use)?In theory, the programmer shouldn't need be be aware of when a move occurs, it should be entirely transparent to them. It is explicit in this demo (and the other one) simply so that I can demonstrate this functionality because the stuff to handle this automatically is yet to be implemented.
Adding this line
println(format("%s:%s:%s:%s:%s",vRem(), vLoc(), vRem(), vLoc(),vRem()))
to the demo causes multiple hops between servers; imagine iterating
Refs inside a list.Yup. In practice, a load balancing mechanism would try to avoid something like that by ensuring that all those Refs are on the same machine.Very interesting stuff, though. Hope I am closer to grokking it.I think so, hope this helps.Ian.
Ian Clarke
CEO, Uprizer Labs
Email: i...@uprizer.com
Ph: +1 512 422 3588
Fax: +1 512 276 6674
So that's an interesting issue. Will the load balancer need to intercept every reduction in order to determine (by statistics and locality) where best to apply the computation? This seems like it could be a detriment to performance. Especially if it makes the effort to move the computation right as it's completing the expensive process.
Has there been much research/discussion on this topic?
On the one hand, the direction of this talk of load-balancing implies
the existence of a data-moving capability. This also implies some
minimal meta-data (what's moveable and how vs. what's not).
On the other hand, is there a way to hookup with the compiler, to
detect the data dependencies that a piece of code would have? I figure
that would help an automated algorithm to figure out which data points
to co-locate. Finding the types to move will then be easy, but we'd
need explicit query-attribute mapping to make explicit the logic
behind associating the data points we need (so they can be co-located
more often then not). Hmm...interesting: the Ref does not need to be a
unique ID but a query with one result.
For instance, in your example with the dating site, the load-balancing
algorithm should know the attributes I use to find the people, not the
people themselves...the query, not the rows. Although, I see that this
could now be moving the "free" code into an association-language, so
maybe not :)
What I was banging my head on was efficiency, specifically when dealing with 1 node/bucket at a time. For instance, you wish to map a function across a list, the problem I see is that deciding a strategy for how to run the function will take as much time as running the function.
Well, perhaps increment a counter (not a significant overhead), yes.
> Since this load balancer is
> Centralized, that's a significant amount of overhead right there.
I don't think the load balancer needs to be centralized, and even if
it were, it would only require summary statistics - you wouldn't
report every single event as it happens.
> It's not
> just storing simple statistics, but building a graph from series of access.
Right, it needs a matrix showing the interactions between different
blocks of data.
> Then, once it makes a decision and begins to move buckets around, you might
> have to deal with a transaction or some form of locking. Then there is the
> copying of data...
Yes, we'll definitely need to deal with concurrency issues.
> Maybe I'm prematurely optimizing, but I think if we take the approach that
> we need to minimize copying data and think more about optimal algorithms for
> representing data in such a way to optimize access, it would be successful,
> and still easy to implement.
Right, I think the load balancing algorithm would only move data when
there is a clear benefit to doing so.
> The approach I would take would be to design the data structures from the
> very beginning so that they efficiently align themselves with an optimal
> access strategy. I agree that a round robin placement would be a horrible
> idea, but using that case in which the data is evenly spread around the
> cluster, the solution I offer with my location aware list would allow access
> in an efficient manner. It could even parallelize access.
I just don't think this should occur at the level of specific
collection-types, rather it should occur at the level below this, at
the level of the object graph, similar to garbage collection.
It may be the case that this can't be done at the level of the object
graph, but so far I haven't seen any compelling reason that it can't.
I think the technical report on Project Darkstar's multi-node data
store is relevant in this regard. Recommend again to read (and see
what lessons are to be learned).
>
> So far I have one issue with the implementation:
> Currently it seems the only thing doing any work is the continuation. What
> do you think about building the Swarm, Store and Queen out of RemoteActors?
> This way, all of these maintenance tasks I just described can be performed
> via simple RPC in an "out-of-band" fashion. I think it would make the
> implementation a bit more straightforward, and more scala-esque.
From my own POV, I think the continuation is a killer feature of Swarm
ATM, which doesn't obviate the possibility of using other
intra-process communication channels. An important aspect of
continuations as Ian has demo'ed them is that from the programmer's
POV, it looks like a normal method, which means one can implement e.g.
algorithms the way one expects them to look in code. That's a big
deal, IMO. I suspect that any serious implementation of Swarm would be
involve more than just continuations, though.
My own focus right now is on using a Tuple Spaces design accessed via
the same APIs Ian coded, which I've got running locally in a crude
demo.
Patrick
I think the technical report on Project Darkstar's multi-node data
store is relevant in this regard. Recommend again to read (and see
what lessons are to be learned).
An important aspect of
continuations as Ian has demo'ed them is that from the programmer's
POV, it looks like a normal method, which means one can implement e.g.
algorithms the way one expects them to look in code. That's a big
deal, IMO. I suspect that any serious implementation of Swarm would be
involve more than just continuations, though.
My own focus right now is on using a Tuple Spaces design accessed via
the same APIs Ian coded, which I've got running locally in a crude
demo.
Patrick
No, not yet. My first step (apart from learning how to dance with Git)
is to get the Maven blah blah Jini blah blah configuration correct so
that others automatically download the right jars and start the
required pieces without any hassle. I'm starting with JavaSpaces since
I have some experience with Jini and since the JS API is drop-dead
simple. Once that configuration is prepared we can play around with
things like the REPL, but it shouldn't be too hard (I imagine it will
just be classpath issues at that point).
Having that configuration in place will also make synchronous calls
via Jini trivial, as well.
Someone said they might simulate the algorithm I proposed a while
back, did anyone get around to that? Anyone still planning to?
Ok, please keep us up to date to avoid duplicated effort, or if you
realize you can't work on it please let us know so that nobody else is
discouraged from addressing it.