I run two consumer web businesses. LineBuzz.com and Geojoey.com. Both have more than 50% of the app impelemented in Javascript and execute in the browser environment.
Something that occurred to me a while ago is that, because most of the execution happens inside the browser and uses our visitors CPU and memory, I don’t have to worry about my servers having to provide that CPU and memory.
I found myself moving processing to the client side where possible.
[Don’t worry, we torture our QA guru with a slow machine on purpose so she will catch any browser slowness we cause]
One down side is that everyone can see the Javascript source code – although it’s compressed which makes it a little harder to reverse engineer. Usually the most CPU intensive code is also the most interesting.
Another disadvantage is that I’m using a bit more bandwidth. But if the app is not shoveling vasts amount of data to do its processing and if I’m OK with exposing parts of my source to competitors, then these issues go away.
Moving execution to the client side opens up some interesting opportunities for distributed processing.
Lets say you have 1 million page views a day on your home page. That’s 365 Million views per year. Lets say each user spends an average of 1 minute on your page because they’re reading something interesting.
So that’s 365 million minutes of processing time you have available per year.
Converted to years, that’s 694 server years. One server working for 694 years or 694 servers working for 1 year.
But lets halve it because we haven’t taken into account load times or the fact that javascript is slower than other languages. So we have 347 server years.
Or put another way, it’s like having 347 additional servers per year.
The cheapest server at ServerBeach.com costs $75 per month or $900 per year. [It’s a 1.7Ghz Celeron with 512Megs RAM – we’re working on minimums here!]
So that translates 347 servers per year into $312,300 per year.
My method isn’t very scientific – and if you go around slowing down peoples machines, you’re not going to have 1 million page views per day for very long. But it gives you a general indication of how much money you can save if you can move parts of a CPU intensive web application to the client side.
So going beyond saving server costs, it’s possible for a high traffic website to do something similar to SETI@HOME and essentially turn the millions of workstations that spend a few minutes on the site each day into a giant distributed processing beowulf cluster using little old Javascript.
Leave a Reply