Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

What is the difference between Web Farm and Web Garden?

, 2 Oct 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
The exact difference between web farm and web garden, and the advantages and disadvantages of using them.

I have been asked this question many times by different readers of my blog. They wanted to know about the fundamentals of Web Farms and Web Garden. In this blog post, I am going to explain the exact difference between web farm and web garden, and the advantages and disadvantages of using them. I have also described how to create web garden in different version of IIS.

Overview

Visual Studio has its own integrated ASP.NET engine which is used to run the ASP.NET Web application from Visual Studio. ASP.NET Development Server is responsible for executing all the requests and responses from the client. Now after the end of development, when you want to host the site on some server to allow other people to access, concept of web servers comes in between. A web server is responsible for providing the response for all the requests that are coming from clients. The below diagram shows the typical deployment structure of an ASP.NET Web application with a single IIS.

2

Clients request for resources and IIS process the request and send back to clients. If you want to know more details on How IIS Processes the request, please read one of my articles about “How IIS Process ASP.NET Request?”.

Web Farm

This is the case where you have only one web server and multiple clients requesting for resources from the same server. But when are is huge amount of incoming traffic for your web sites, one standalone server is not sufficient to process the request. You may need to use multiple servers to host the application and divide the traffic among them. This is called “Web Farm”. So when you are hosting your single web site on multiple web servers over load balancer is called “Web Farm”. The below diagram shows the overall representation of Web Farms.

Web Farms

In general web farm architecture, a single application is hosted on multiple IIS Server and those are connected with the VIP (Virtual IP) with Load Balancer. Load Balancer IPs are exposed to external world to access. So whenever some request will come to server from clients, it will first hit the Load Balancer, then based on the traffic on each server, LB distributes the request to the corresponding web server. These web servers may share the same DB server or may be they can use a replicated server in the back end.

So, in a single statement, when we host a web application over multiple web servers to distribute the load among them, it is called Web Farm.

Web Garden

Now, let’s have a look at what is Web Garden? Both the terms sound the same, but they are totally different from each other. Before starting with Web Garden, I hope you have a fundamental idea of what an Application Pool is and what a Worker Process is. If you have already read the article, “How IIS Processes ASP.NET Request ?”, then I can expect that you now have a good idea about both of them.

Just to recall, when we are talking about requesting processing within IIS, Worker Process (w3wp.exe) takes care of all of these. Worker Process runs the ASP.NET application in IIS. All the ASP.NET functionality inside IIS runs under the scope of worker process. Worker Process is responsible for handling all kinds of request, response, session data, cache data. Application Pool is the container of worker process. Application pool is used to separate sets of IIS worker processes and enables a better security, reliability, and availability for any web application.

apppools

Now, by default, each and every Application pool contains a single worker process. Application which contains the multiple worker process is called “Web Garden”. Below is the typical diagram for a web garden application.

WebGarden Basic

In the above diagram, you can see one of the applications containing the multiple worker processes, which is now a web garden.

So, a Web application hosted on multiple servers and access based on the load on servers is called Web Farms and when a single application pool contains multiple Worker processes, it is called a web garden.

Create Web Garden in IIS 6 and IIS 7

Now, I am going to show how you can change the Number of Worker processes in both IIS 6 and IIS 7. For IIS 6, Right Click on Application Pool > Properties > Goto Performance Tab.

WebGardenIIS6

In the “Performance Tab” section, you would have one option called “Web Garden” where worker process sets to “1”, you can set the number of worker processes that you required.

For IIS 7, Right Click on Application Pool > Go To Advance Settings > In Process Model section, you will have “Maximum Worker Processes”. You can change it more than 1 to make it as a web garden.

WebGardenIIS7

In the above image, you can also check the definition of Web Garden.

You can find one of my previous articles on the basics of the same over here.

Advantages of Web Farm and Web Garden

Now, let’s have a look into the advantages of both the Web Farms and Web Gardens.

Advantages of Web Farm

  • It provides high availability. If any of the servers in the farm goes down, Load balancer can redirect the requests to other servers.
  • Provides high performance response for client requests.
  • Provides better scalability of the web application and reduces the failure of the application.
  • Session and other resources can be stored in a centralized location to access by all the servers.

Advantages of Web Garden

  • Provides better application availability by sharing requests between multiple worker process.
  • Web garden uses processor affinity where application can be swapped out based on preference and tag setting.
  • Less consumption of physical space for web garden configuration.

How to Manage Session in Web Farm Mode?

While using session, requests are distributed among different servers. By default, session mode is set to In Proc where session data is stored inside worker process memory. But, in Web farm mode, we can share the session among all the servers using a single session store location by making it Out proc (State Server or SQL Server Mode). So, if some of the servers go down and request is transferred to the other server by the Load balancer, session data should be available for that request.

sessionWebfarm

In the above diagram, you can see that we can both the IIS server sharing the same session data which is stored in out of worker process. You can read one of my previous articles “Exploring Session in ASP.NET” where I have explained how you can configure session mode for Out Process mode.

How to Manage Session in Web Garden Mode?

When we are using Web garden where request is being taken care of by different worker process, we have to make the session mode as out process session mode as described earlier. For Web Garden, we have to configure the out process within the same server but for different worker process.

webgardenSession2

While using Web garden with your application, you need make a couple of configuration settings in web.config in <process Model> section where you need to set certain properties like cpuMask, RequestLimit, webGarden, ClientConnectCheck, etc.

Summary

When we host a web application over multiple web servers to distribute the load among them, it is called Web Farm and when one application has multiple worker processes, it is called a Web garden.

In this blog post, I have explained the very basics of what a Web Farm is and what a Web Garden is. As this blog post contains the basic information to understand the fundamentals of web farms and web garden concept, I will be posting a separate article with details configuration setting for web garden and web farm. You can read the following articles for more information:

Hope this will help you.


Filed under: ASP.NET, ASP.NET 4.0, IIS

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Abhijit Jana
Technical Lead
India India
.NET Consultant | Former Microsoft MVP - ASP.NET | CodeProject MVP, Mentor, Insiders| Technology Evangelist | Author | Speaker | Geek | Blogger | Husband
 
Blog : http://abhijitjana.net
Web Site : http://dailydotnettips.com
Twitter : @AbhijitJana
My Kinect Book : Kinect for Windows SDK Programming Guide
Follow on   Twitter

Comments and Discussions

 
QuestionWeb farm and web gardan Pinmemberpathumca18-Sep-14 3:23 
GeneralMy vote of 5 PinprofessionalAmey K Bhatkar26-May-14 7:37 
QuestionMy Vote of 5 Pinprofessionalashok rathod8-Apr-14 21:30 
Questiongood explaation PinmemberSoumitra Mithu27-Nov-13 5:02 
GeneralMy vote of 5 Pinmembernileshbhai10-Sep-13 23:54 
QuestionWeb Farm with Database Mirroring PinmemberBabun isahoo13-Jul-13 4:49 
GeneralAewsome Article about Web Farm & Garden Pinmemberchakraproject24-Jun-13 3:44 
QuestionExcellent post Pinmembervanimankad6-Jun-13 5:15 
GeneralExcellent explanation Pinmemberhaarika19-Apr-13 0:44 
SuggestionGood Explanation... PinmemberPrabhuPalaniappan12-Feb-13 1:42 
GeneralMy vote of 5 PinmemberSamehG18-Jan-13 8:11 
GeneralMy vote of 5 PinmemberMico Perez16-Jan-13 21:52 
QuestionMy Vote 5 PinmemberHarshit Raj Singh21-Oct-12 1:50 
GeneralMy vote of 5 Pinmembercatfish1015-Oct-12 5:38 
Questionnice work,good to read it PinmemberYogesh Lodha13-Jun-12 4:39 
GeneralMy vote of 5 PinmemberJeff.Crawford25-Apr-12 2:51 
GeneralMy vote For This Pinmemberonurag1926-Mar-12 22:20 
QuestionIt' very nice and I have a question PinmemberSunnyPeng18-Jan-12 17:03 
AnswerRe: It' very nice and I have a question PinmentorAbhijit Jana18-Jan-12 20:14 
GeneralMy vote of 5 PinmemberSunnyPeng18-Jan-12 17:00 
GeneralMy vote of 5 Pinmembertareq_moinul11-Oct-11 10:00 
QuestionNice one PinmemberSanjay JDM10-Sep-11 23:08 
AnswerRe: Nice one PinmvpAbhijit Jana20-Sep-11 8:40 
GeneralMy vote of 5 PinmemberAbhinav S7-Nov-10 7:18 
GeneralRe: My vote of 5 PinmvpAbhijit Jana9-Nov-10 6:38 
GeneralMy vote of 5 Pinmembers_okasha11-Oct-10 0:45 
GeneralRe: My vote of 5 PinmvpAbhijit Jana2-Nov-10 8:48 
GeneralMy vote of 5 Pinmembervenkat4all7-Oct-10 21:45 
GeneralRe: My vote of 5 PinmvpAbhijit Jana9-Oct-10 1:41 
GeneralMy vote of 5 PinmemberRichard Waddell7-Oct-10 16:28 
GeneralRe: My vote of 5 PinmvpAbhijit Jana9-Oct-10 1:41 
GeneralMy vote for 5 PinmemberGaurav Dudeja India3-Oct-10 21:11 
GeneralRe: My vote for 5 PinmvpAbhijit Jana6-Oct-10 23:49 
GeneralMy vote of 5 PinmentorBrij3-Oct-10 3:09 
GeneralRe: My vote of 5 PinmvpAbhijit Jana3-Oct-10 4:08 
GeneralMy vote of 5 PinmvpAbhishek Sur2-Oct-10 9:42 
GeneralRe: My vote of 5 PinmvpAbhijit Jana2-Oct-10 21:25 
GeneralMy vote of 5 PinmentorKunalChowdhury2-Oct-10 9:19 
GeneralRe: My vote of 5 PinmvpAbhijit Jana2-Oct-10 21:24 
GeneralMy vote of 5 PinmvpAl-Farooque Shubho2-Oct-10 7:34 
GeneralRe: My vote of 5 PinmvpAbhijit Jana2-Oct-10 21:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 2 Oct 2010
Article Copyright 2010 by Abhijit Jana
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid