What if you could offload some of your computational work onto the visitors of your site? We thought it would be pretty cool to make a quick little app to test the theory out using Google App Engine.
We opted to use the MapReduce paradigm as made famous by Google. The workflow is like this:
- Admin (you) create a new job
- Admin adds data set, a line break delimited string
- Admin adds a map function, written in pure javascript
- Admin adds a reduce function
- Client visits web page with javascript embedded
- Javascript library prompts the user to contribute CPU cycles and writes to a cookie to remember
- If user accepts, request a random function and data set item from all jobs that is not complete
- Execute job and submit result
- Request another job, if there is none, wait a while and check again, if there is, don’t delay and start step 8 again
It works like a charm! Try it out at http://bbmapreduce.appspot.com/. You can find the sources on my GitHub project page. To allow your visitors to contribute CPU cycles, simply include the script tag at http://bbmapreduce.appspot.com/client/sample in your website.
It should be noted that was not written with security in mind and you can never trust the data that gets sent back from your visitors, but there are ways to make it more reliable, such as executing one function on multiple clients and checking the data returned against the rest which is not currently implemented. The other issue is that the jobs being submitted on this test site is completely open and thus prone to spam alert calls.
*DISCLAIMER*
I am not responsible for any harm this causes you, your computer, or anyone who visits the URLs provided. This is simply for educational purposes.
No related posts.



Excellent idea! Though the javascript might seem to be a limitation for now, it is a great leap.