Cloud Experiments

A recent project I was on was written in Erlang, which I now find extremely interesting as a programming tool. I do, however, have a software business focusing on small and medium sized businesses, which should come as no suprise has very few opportunities to use something like Erlang without a lot of explanations up front.

So, a little here, a little there I started trying to pull out the interesting cloud-like capabilities of that might be useful in other languages... and seeing if I might be able to apply them to some of the tools I currently use. I've come up with two moderately successful prototypes: 1) Distributed Javascript processing and 2) Distributed PHP processing

Javascript

As reviled (and revered) a tool as Javascript is, I believe that Web 2.0 has pretty much cemented Javascript as a language of the future. So, my reasoning says, since computing is moving "into the cloud" (insert random definition) and requires massive parallelization, I believe good old JS could learn a thing or two from Erlang. Spawning processes on a lightweight thread, clouds of machines working together, a message queue per process, a signalling system, copy-on-write (or on call) ... lots of little things that would make Javascript automatically distribute into a cloud.

But is it possible? Yes, Javascript showed me it has one great little feature that I never expected. By referring to a function, you can actually get the source to the call:

 
var X = function(A){ alert(A);}

document.write(X);
X('woo!'); 

Drop this code into a blank html page, and you'll see it call the function X, as well as dump the source. This was an eye opener. I have a working prototype, using PHP as a "marshall" to push code, and accompanying data, out to multiple servers to be processed. This isn't quite the way Erlang does it, but definitely offers a working example that this kind of cloud behavior is possible... so given an array of websites, or numerical data, we can Map and Reduce over an extended cloud - the whole thing being done in JS.

I'm trying to decide whether to open-source the project (It uses Erlang underneath since it handles much of the workload quite nicely) - or if I should try and build a product with it. I'd be open to suggestions or assistance, or partnerships.

PHP

So, I thought, PHP seems like a fairly dynamic language - that would let me get away with similar things. Not quite - BUT, I was able to prototype a "roundrobin" type worker system, using asynchronous socket calls in PHP - literally calling back into the PHP pages to perform the work. PHP can do some dynamic includes, and call_user_func magic as well, giving us a nice way to take an array of data and process on multiple machines, with no special software other than the PHP pages.

This isn't exactly what I want, but it does allow for some extremely parallel processing for PHP. I'd like to scale up the idea and make a series of PHP servers work in tandem as a cloud - but for now I plan on just using it to start running the Wallcloud website again.. hopefully this time without so much of my own interaction.

Anyway, just some thoughts for you to consider. - Mike




Page :  1