Wednesday, September 30, 2009

Web Farm and ASP.NET

This is an abstract of the Web Farming in ASP.NET. Just like “Capsule”. Before discussing about Web Farm, we need to get some basic knowledge about Server Farming.

What is a Cluster Computer or Server Farm?

Cluster Computer (Server Farm) is virtually a SINGLE computer system, but logically it includes multiple computers. That means, there are multiple computers, but it works as a single unit. These computers are usually connected by Local Area Network. The Load Balancing logic decides how/which computer in the Cluster to do the task.

Load Balancer

Load Balancer can be Software or a dedicated Hardware, but its function is same to forward the request to actual Server. The Load Balancer will decide which server should be used for getting optimal performance. The decision will be based on the configured scheduling algorithm. Example for scheduling algorithm: - Round Robin, Random, Weighted Round Robin etc..

What is Web Farm?

A major use of Server Farm is for hosting web sites. In this case we will call the server farm as Web Farm. By using web farm for hosting web site we can make sure the availability and performance of the web site.

How it works?

The web farm is a collection of web servers, but all are hosted with same websites. If a user requests an HTML page in the website (Eg:- http://testserver.com/home.html), this will come to the Load Balancer. Then it will forward this request to anyone of the web server. That means all the requests to the website are routed through the Load Balancer. So we cannot say the user will be served by the same web server for all his requests.

Web Farm & ASP.NET

Simply a website is stateless. That means it will forget all about the previous page request. For example, User A requests home.html, then Aboutus.html. Here the web site cannot identify both requests are from the same user. Each request will be treated as an independent request.

Microsoft ASP.NET has an advance feature, it provides Session State Management. That means it keeps memory of the page requests. So it can identify the requests from the same user.

So the problem arises in the Web Farm.

Assume, we are browsing a shopping web site for purchasing a Laptop. The Products.html page contains all the models of Laptop and “Purchase” button against each Laptop. While clicking on the “Purchase” button the users will be redirected to CreditCarddetails.html page and collects the details. Here the website keeps the Product selected in the first page in his memory for later processing. If this happens in a web farm, there will be a problem. For instance, the first request will be to Webserver1 and second will be to Webserver2. So Webserver2 will not get the information collected in the first request.

Solutions For this Problem

There are too many solutions for this problem. These are the commonly used solutions

1. Use SQL Server or State Server for keeping state information.
Here the state information will be kept in a shared Database or a shared service. So all the web servers can access this and can recollect its memory even though the previous request was to another web server.

2. Persistence/Stickiness.
This is usually done through client side page redirecting. The first request will be through the load balancer, while processing the first request the URL will be replaced with new URL. This new URL is the URL of an individual web server not the Load Balancer. The main problem is, the underlying web servers are visible to the network.

5 comments:

Anonymous said...

They cаn alѕo offer a dеcoratiѵе elеment tο the
rοom. It alѕo increases ouг expenses.
Whatеver yοur lifestyle, you're sure to find the right lighting to complement it.

Here is my web site - hunter ceiling fans with lights at menards

Anonymous said...

I am regular rеader, how aгe you everybody?
This piece of writing posted at thіs site
is actually pleasant.

Viѕit mу ωeb page ... seo company lancaster

Anonymous said...

Thanks Lynda, I had been hoping that may show the method a tad bit more
clearly while not having to make you view the whole lot in real-time!


My web site :: ,jewellery discount online

Anonymous said...

sir, satisfy send out the video to my e-mail, its amazing.



Also visit my web site xerox phaser 8560 color printer

Anonymous said...

Hi, I do believe this is a great website. I stumbledupon it ;) I'm going to return once again since I bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

my blog; xerox 8560 error codes

landscape paintings nature art landscape art sky art illustration art artwork art human art beautiful art landscape prints nature prints sky prints illustration prints artwork prints human prints beautiful prints beautiful special promotions nature special promotions sky special promotions illustration special promotions artwork special promotions beautiful canvas prints beautiful painting canvas prints beautiful framed prints beautiful painting framed prints beautiful posters beautiful painting posters