Web Farm and Web Garden



WEB FARM:

A hosting environment consisting of multiple web servers is said to be a Web Farm. Usually a load balancer is used to tie together the web servers, which routes incoming requests amongst the servers within the web farm.

And these incoming requests are routed in a variety of formats: One from them is to use IP affinity (also called client affinity or sticky session); it's working is to route the incoming requests to the same web server for the duration of the web application session. It has a benefit that Session state data can be maintained in-process, just as it would on a single web server hosting environment, without the complications from alternating between web servers. However, a down-side to IP affinity is in not taking full advantage of the web farm capability in fully distributing and routing all requests and sessions.

WebFarmGard1.gif

USE: The Web farms are used in enterprise environments for highly-used web applications to provide fail-safe and reliable services. Web farms offload incoming traffic by alternating between servers and by evenly distributing web application load. This increases response time, performance, and reliability. Additional web servers may be added or taken away from a web farm to increase or decrease the web application performance, as necessary for target environment.

Advantages of a Web Farm

  • It Provides better scalability by handling large capacity
  • Due to centralized monitoring of the web sessions good web site administration.
  • Optimum utilization of resources that can be shared to service clients
  • It Provides redundancy by reducing failures with the help of fault tolerance techniques
  • It Provides availability and better performance due to load balancing

WEB GARDEN:

Web garden is a scenario in which a single machine has multiple asp.net worker processes running simultaneously. A web garden is utilized on a multi-core web server. To achieve more robust execution and processing of the C# ASP .NET web application threads, each worker process within the application pool would execute on an individual processor. It is created within Internet Information Services (IIS) by creating an application pool, selecting the Performance tab, and under the "Web Garden" section, setting the maximum number of worker processes to a value greater than 1.

WebFarmGard2.gif

USE: Rather than using the typical hosting environments, the web gardens use more resources, and may also be slower in performance due to which there is unnecessary complexity. It has useful scenarios which may include when a non-CPU bound application needs to execute a long running request, such as an intensive computational request, long database transaction, or other long process. In both cases, a web garden could offer a solution by offloading the single worker process and distributing incoming requests amongst the workers in the application pool.

The larger gain for web gardens is not speed, but rather robustness. Due to their robustness, enabling web gardens can often be a good way to see if a C# ASP .NET web application will function correctly in a multi-server web farm environment. Often, if a web application performs well in a garden scenario, it will typically be easier to migrate to a web farm.

Advantages of Web Garden
  1. It increases application availability
  2. Less consumption of physical space with better capacity
  3. Optimum utilization of processes running on multiple processors located in a single server
  4. Finer grained partitioning of Web servers help to control the administration of web sites individually, though they reside on the same server
  5. With the concept of Processor affinity (binding the application to processor with the help of CPU masks), applications can be swapped out and restarted on the fly.
  • IMPLEMENTATION OF WEB FARM IN .NET:

    To implement a web farm in .Net, the following changes have to be made in a web.config file:

    Mode = [inproc/StateServer/SqlServer]

    The inproc option is to be used when there is no web farm, StateServer when performance is required while SqlServer, if reliability is needed, especially for mission critical applications.
     
  • IMPLEMENTATION OF WEB FARM IN .NET:

    To implement a web garden in .Net, the following changes have to be made in a web.config file:
     
    • webGarden=[true]

      Option, false used, if web garden is not necessary.
    • CpuMask=8
      Value for this section implies the decimal number, whose binary form represents the sequence of processors running ASP.net processes on a multiprocessor server.
     
  • Difference between "Web farms" and "Web garden":

    Web farms consist of two or more web servers of the same configuration and they stream the same kind of contents to minimize failures, hence web farms are used to have some redundancy. It consists of two or more web servers of the same configuration and they stream the same kind of contents. When any request is received there is switching / routing logic that decides which web server from the farm handles the request. Whereas in short we can define a model in which multiple processes run on multiple CPUs in a single server machine which is known as a web garden. Let's discuss that with the help of models:

    WebFarmGard3.gif

    All requests to IIS are routed to "aspnet_wp.exe" for IIS 5.0 and "w3wp.exe" for IIS 6.0. In a normal case i.e. without a web garden we have one worker process instance ("aspnet_wp.exe" / "w3wp.exe") across all requests. This one instance of worker process uses the CPU processor as directed by the operating system:

    WebFarmGard4.gif

    But when we enable a web garden for a web server it creates different instances of the worker process and each of these worker processes runs on different CPUs. You can see in the diagram below we have different worker process instances created which run on different CPUs.

    WebFarmGard5.gif
     

erver'>
Up Next
    Ebook Download
    View all
    Learn
    View all
    F11Research & Development, LLC