天天看點

Web Farm和Web Garden的差別

經常有人問題什麼是Web Farm, 什麼又是Web Garden?

他們的有什麼差別?

今天我們就來看一下他們之間的差別

我們知道, web server負責處理用戶端的請求然後再傳回給他們.

但是,當請求很多的時候,一台伺服器可能承受不了, 這個時候,我們就需

要用多台web server來分擔請求的壓力, that is called to divide the traffic among them.

這就是web farm

web farm -- hosting your single web site on multiple web servers over load balancer

通常,我們在web farm的架構中, 不同的web server通過load balancer和虛拟IP進行連接配接

因為,當請求過來的時候,它最先接觸的是load balancer, LB把請求分發給相關的web server

web garden

首先,我們來了解一下什麼是Worker Process, 在IIS中Worker Process(w3wp.exe)負責處理

所有的請求, 相應,緩存等, Application Pool則是Worker Process的容器, 應用程式池用來被用來分割

Worker Process的集合以保證最佳的穩定性

每個應用程式池預設隻有一個工作程序, 但是,如果應用程式池包含了多個工作程序,這種方式就叫做

在IIS6/7中建立web garden的步驟:

IIS6

1) Right Click on Application Pool -> Properties -> Goto Performance Tab

2) 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

IIS7

1) Right Click on Application Pool -> Go To Advance Settings -> In Process Model section

     you will have “Maximum Worker Processes”

2) You can change it more than 1 to make it as a web garden

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.

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.

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.

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.