As I wanted to find good reasons to use Javascript as a language to do image processing, I thought of distributed computing that would be extremely easy to do. Users have nothing to install, they just have to visit a webpage. And since we want many users to participate we could embed it into a popular webpage.

There are many issues using browsers as distributed computing nodes:

  • User approbation: Will they allow you to run random script on their machine as they just wanted to visit a site.
  • Liability of the Data: Since process is being done on untrusted people, we must find ways to verify it.
  • User disconnection: We are going to compute the data while they are browsing the web, if they change of URL, reload the page or close their browser we wont get any result.

User Disconnection Over Time

In order to test the last point, I added a small Javascript program on the popular website MMO-Champion.com. Every one minute, it will send the time spent on the page to my server. I ran it for about 2 hours (then it DDOS'ed my server :(). I aggregated the results in the following chart.

We can extract 3 phases from this graph.

  • Under 5 minutes the user is really likely to disconnect.
  • Between 5 and 15 minutes, the chance of disconnection is reducing
  • After 15 minutes, really few users are disconnecting.

You can see it in another way:

  • 50% of the users that have stayed 10 minutes are staying 1 hour.
  • 10% of the users that have stayed 1 minutes are staying 1 hour.

Chance of Script Completion

What we really want to know is either or not our script will complete. In order to test that I took the data we gather and computed the percentage of users that would still be there X minutes later.

After 15 minutes, a script that takes 1-10 minutes to complete has 95% chance of finishing without being interrupted.

Conclusion

The user disconnection is not really an issue. If do the computation on users that are staying more than 15 minutes, we have a 95% rate of completion for a 10 minutes script.

If you liked this article, you might be interested in my Twitter feed as well.
 
  • http://bateru.com/ Larry Battle

    Isn't this proposal also assuming that the computations don't affect the browser's performance?
    I'm not sure about others but if I run a web-page that slows download my browser or starts the fan running then I exit the site immediately.
    But I guess you could easily fix the issue by using setInterval and computing small amounts of data with each loop.

    Nice Article.

  • http://vjeux.com vjeux

    This is indeed an issue. I don't exactly believe that this could be done on behalf of the user.

    I just have the thought of the web as a massively distributed environment. I just wanted to know if technically it would be possible.

    Now, this is an ethical complex subject and this is not the goal of the article 🙂

  • Ciurmy

    the problems that you mentioned in this interesting article regarding the new frontier of grid computing: THE DISTRIBUTED JAVASCRIPT CONPUTING.

    To solve them you have to build a set of rules that reward users who:

    1) do not close the browser and end the calculation assigned

    2) do not write bug within codes

    At present the only platform that has implemented THE JAVASCRIPT DISTRIBUTED CONPUTING is ciurmy.com, but in the future I'm sure many more will be born.

  • Ciurmy

    Usually the calculations are done from the web workers (HTM5). Consider that a standard computer has more than one cpu; so a webworker can work with one of the cpu not used. In other words, the slowdown there will not be if you have a multi-processor.

  • Ciurmy

    it is technically possible and become the standard 🙂

 

Related Posts

  • February 23, 2012 Dassault Systemes Javascript Evangelism Talk (0)
    I recently had the chance to do a 2-hour Javascript evangelism talk at Dassault Systèmes. Unfortunately the presentation has not been recorded. I reused my the presentation I did at EPITA at the beginning and added a second part with a lot of demos. I've written down notes about the […]
  • August 27, 2011 Start a technical blog, it’s worth it! (4)
    Lately, I've been advocating to all my student friends to start a blog. Here's an article with the most common questions answered :) What are the benefits? Being known as an expert. The majority of my blog posts are about advanced Javascript topics. As a result, I'm being tagged as […]
  • October 5, 2011 Javascript Presentation (1)
    The talk is over. Check out the Slides & Video. For several months now I've been surveying my friends and teachers at EPITA and I came to the conclusion that they have absolutly no idea what Javascript really is. In order to help them discover a language that is getting a lot of […]
  • September 25, 2011 Javascript Object Difference (5)
    This article is about a difference algorithm. It extracts changes from one version of an object to another. It helps storing a smaller amount of information. Template In a project, I have a template object with all the default settings for a widget. var template = { […]
  • April 5, 2012 Climb – Property-based dispatch in functional languages (1)
    ELS Presentation | A Generic and Dynamic Approach to Image Processing | Chaining Operators & Component Trees | Property-based dispatch in functional languages This is the third (and last) presentation about my work on Climb at the LRDE. During the first one I tackled genericity […]