Vershun’s Brain Dump

Decentralized Distributed Flash Proof of Concept

by Vershun on Feb.13, 2010, under Computers

Finished my lil’ project I’ve been working on. You can view it by clicking the link below.

View the app and participate in the network.

It doesn’t really have a name, but for the purposes of this post I’ll refer to it as DDFPOC (Decentralized Distributed Flash Proof-Of-Concept).

DDFPOC is a prototype for a new way of utilizing web traffic for computational purposes. Inspired by projects like BOINC and Folding@Home, I wanted to find a way to have casual web surfers participate in a computational network just by visiting a webpage. Deviating from the BOINC and Folding@Home models and my prior Flash-based distributed computing POC, I also wanted information sharing across the clients as opposed to a central location that aggregates all the separate work units together. Finally, I wanted to have a visual representation of the network so the users could see what’s happening within the network and what the work units were doing.

Implementation Details

The client-side application was programmed entirely in Flex and uses the awesome dependency graph provided with Flare.  The server-side code is in PHP5.  The Flash application makes framework and worker requests to the server in set intervals.  The framework requests are to get the status of the network — who is currently in the network, who’s connected to who, and statistics.  The worker messages are for sending and receiving messages about the current worker.

Spoiler: it’s not really decentralized. I didn’t make the program to do Flash-to-Flash communication, so messages passed between clients are routed through the server.

Green is a message in, red is that same message out.

There are 2 main parts to both the Flex and the PHP: the framework and the worker.  For Flex, the worker module only has to implement an interface.  If this project continues forward (which I doubt due to my project ADD), I would like to be able to add and remove worker modules during runtime.  That way the client could choose which project they would like to donate their CPU cycles to (much like BOINC).  The PHP is a bit more messy, and there’s a couple places where the implementation of the worker is coupled with the user management (such as clearing out expired users).  Aside from these few places, though, the PHP worker is pretty encapsulated and I don’t think it would be much work to make it entirely so.

What’s With The Number Guesser?

I chose to implement a random number guesser as the first POC worker for the following reasons: it’s easy to understand, the knowledge sharing is trivial, it didn’t have to be very visual.

On the PHP side: if there is no work unit out (a number had recently been found), the PHP worker generates a new number between 1-1000 and informs the client that there’s a new work unit.

On the Flash side: keep guessing numbers between 1-1000 until you find the answer or someone else does.

The knowledge sharing works as follows:  keep track of the numbers you guess and tell the neighbors you’re linked to what numbers you’ve tried.  When a neighbor informs you of their guesses, add them to your “already guessed” pile.  Forward on to your neighbor’s guesses to your neighbors.  Eventually the network will guess the number using all of the clients’ memory of guessed numbers.

In The Future

This project was made to be throw-away, but if it were to continue forward I’d first like to completely decouple the framework and worker on the server side.  Next would be making the Flash worker load dynamically.

What I’d love to see is an actual application for this.

Notes

Keep in mind this is a POC and isn’t well tested, I expect bugs :D .

Also, if there’s any interest I’d be happy to release the source code.

Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
:, , ,
No comments for this entry yet...

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...