Scale in the browser

by Mads Kristensen 21. September 2009 14:17

Last week a colleague and I gave a talk about scalable architecture and where my colleague talked about databases and application layer scaling, I talked about scaling websites. More precisely, we talked about the upcoming ZYB/Vodafone project

Since there’s still a lot of secrecy about the project, we managed to keep the concepts general. General or not, I’d like to share some thoughts on a different way of scaling websites.

Load balancing

Larger websites are often hosted on multiple web servers under a load balancer that distributes the requests evenly among the servers. This is an old technique for scaling out websites and has been widely used as the de facto scaling mechanism for years.  It’s good, it works and it’s cheap. It’s cheap because web servers often don’t have to be the biggest machines in contrast to e.g. database servers.

So, a load balanced web server setup provides good and cheap scaling possibilities.

Reversed load balancing

Any website, load balanced or not, can also use the vast untapped resources in the visitor’s browsers. Think about it. Quad core CPU’s and 4GB memory is almost standard today – even on laptops. Why not utilize the machine power behind the browsers to do some of the scaling for us?

Traditionally, this is done using browser plug-ins like applets, Flash and Silverlight, but many more sites use JavaScript. Modern browsers process JavaScript very fast and efficient which makes it possible to use JavaScript for scaling purposes.

To utilize the browsers memory we can cache data in JavaScript so we can eliminate chatty communication with the web server. An example would be to load all the data needed behind the scenes after the page is loaded and store it in JavaScript variables.  To utilize the CPU we can make calculations, dynamic rendering and other logic in JavaScript as well.

By pushing some of the load to the browser we are able to scale even more than just using regular load balancing.

It’s not for everyone

There are some problems with this approach that makes it a bad choice for some websites. If enough of the visitors are using old browsers like IE6 then they will get a worse experience because JavaScript runs too slow. There’s also the case where a website just doesn’t have any data to cache like a personal website.

For other types of websites it makes perfect sense. If your visitors have modern browsers and your website is heavily data driven, then it’s a possible candidate. The tests we have done at ZYB shows huge benefits by loading data behind the scenes - both the performance and scalability improves significantly. The load on the web servers dropped drastically with this technique. I hope to be able to show you some real numbers later.

Tags: , ,

ASP.NET | Client-side

Comments

9/21/2009 3:17:56 PM #

redsquare

Matt,
What about non-js clients?

redsquare United Kingdom |

9/21/2009 4:56:28 PM #

Roberto

Mah ... si vedrà?

Roberto Italy |

9/22/2009 9:23:42 AM #

trackback

Scale in the browser

Thank you for submitting this cool story - Trackback from PimpThisBlog.com

PimpThisBlog.com |

9/22/2009 3:08:41 PM #

Ib

Thank you for a great presentation last Thursday. You and your colleague did a great job. By far the best presentation that day.

Would be great if you posted more details on your blog later on.

Ib Denmark |

9/23/2009 2:45:33 PM #

Mads Kristensen

Thanks

Mads Kristensen United States |

9/23/2009 2:53:40 AM #

pingback

Pingback from random.cgi-biz.com

ASP.NET -   Scale in the browser - Random Things To Blog

random.cgi-biz.com |

10/12/2009 4:03:49 AM #

Oes Tsetnoc

Hi any updates regarding the said vodaphone projects? I think people should update themselves from the latest versions to avoid such problem. But it can be prevented, some people are really can get away with the old times.

Oes Tsetnoc United States |

Comments are closed

About the slave

Mads Kristensen Mads Kristensen
Web developer at ZYB and founder of BlogEngine.NET. More...

LinkedIn ZYB Facebook Last.fm Twitter View Mads Kristensen's profile on Technorati

The Lounge

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008