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的集合以保证最佳的稳定性
每个应用程序池默认只有一个工作进程, 但是,如果应用程序池包含了多个工作进程,这种方式就叫做
web garden
在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
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.
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.