Configuring Web Gardens with IIS 6.0 (IIS 6.0)

IIS6 Web Garden 指的是一个应用程序可以成多个进程(w3wp.exe)来执行,一次请求使用其中的一个。用这个的主要目的是提高程序的可用性。当其中一个进程发生错误,那么也不会影响其他进程。发生错误的进程可以根据规则关闭,而其他的进程则可以继续工作。
 
可惜不是每个应用程序都支持Web Garden的。 例如我做的那个就不是。
 
一般来说 , 不支持 Web Garden 的原因是各应用程序的内存状态是不同的。虽然是访问同一个网站 , 当访问第一个进程时,进程的内存如果纪录了某些重要的信息,而当访问第二个进程的时,却无法再得到那些信息时,那么程序就不一定能运行正常,或者会发生错误。
 
所以,一般使用 InProc HttpSessionState / HttpApplicationState / 静态变量来储存关键信息 的程序是不支持 Web Garden的。另外平时说Session信息丢失,也和这个有关。一般很多程序都使用Cache来储存临时数据,但如果某些被修改或删除的数据没有在该进程的Cache中得到更新,那么也会很容易导致程序出错。 


如果你的程序用上面说的方法,并且在Windows2003/IIS6中发生奇怪的错误,那么请检查一下Web Garden的设置。


如果你希望应用程序支持Web Garden,甚至是支持集群,那么最简单的办法就是,尽量用Cookie来纪录登陆信息,以及所有的数据获取的动作都是从数据库中读取。例如Duwamish就是这种类型的程序。 
 
如果一个应用程序连Web Garden都不支持,那么就更难支持集群了。
http://blog.joycode.com/lostinet/archive/2005/02/02/44017.aspx


Web Garden是IIS6的一个功能。Google一把,搜到MSDN的关于Web Garden的英文文档(http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/659f2e2c-a58b-4770-833b-df96cabe569e.mspx?mfr=true),大概浏览了一下同时也获得了另一个名词:Web Farms。
Web Garden:IIS6 Web Garden 指的是一个应用程序可以成多个进程(w3wp.exe)来执行,一次请求使用其中的一个。用这个的主要目的是提高程序的可用性。当其中一个进程发生错误,那么也不会影响其他进程。发生错误的进程可以根据规则关闭,而其他的进程则可以继续工作。(引用别人滴,俺自己还没理顺怎么解释它。)


Web Farms:资料很少,但意思应该是对于大部分程序来说都是用这个方式的(相对比于Web Garden)。

Important

This feature of IIS 6.0 is available only when IIS is running in worker process isolation mode.

In IIS 6.0 worker process isolation mode, application pools enhance Web site or application reliability by isolating applications and the worker processes that service those applications. For even greater reliability, you can configure an application pool to be supported by multiple worker processes. An application pool that uses more than one worker process is called a Web garden. The worker processes in a Web garden share the requests that arrive for that particular application pool. If a worker process fails, another worker process can continue to process requests.

  Note

Web gardens are different from Web farms. A Web garden is configured on a single server by specifying multiple worker processes for an application pool. Web farms use multiple servers for a Web site.

Creating a Web garden for an application pool can also enhance performance in the following situations:

Robust processing of requests: When a worker process in an application pool is tied up (for example, when a script engine stops responding), other worker processes can accept and process requests for the application pool.

Reduced contention for resources: When a Web garden reaches a steady state, each new TCP/IP connection is assigned, according to a round-robin scheme, to a worker process in the Web garden. This helps smooth out workloads and reduce contention for resources that are bound to a worker process.

Procedures

Important   You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type runas /user:Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".

To configure a Web garden by using IIS Manager

1.

In IIS Manager, expand the local computer, expand Application Pools, right-click the application pool, and then click Properties.

2.

Click the Performance tab, and under Web garden, in the Maximum number of worker processes box, type the number of worker processes that you want to assign to the application pool. (You must type a number greater than 1 for the application pool to become a Web garden.

3.

Click OK.

Optionally, you can configure a Web garden by setting the metabase property MaxProcesses. The MaxProcesses property determines the maximum number of worker processes that an application pool allows to service its requests. A value of zero indicates an unmanaged application pool that is not served by a worker process.

The default value for the MaxProcesses property is 1, which is the default number of worker processes that service an application pool. To configure an application pool so that it is a Web garden, set the MaxProcesses property to a value greater than 1.

Important   You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, typerunas /profile /user:MyComputer\Administrator cmd to open a command window with administrator rights and then type cscript.exeScriptName (include the script's full path and any known parameters).

To configure a Web garden by using Adsutil.vbs

1.

In the Run dialog box, type cmd, and then click OK.

2.

At the command prompt, type:

cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AppPools/ApplicationPoolName/MaxProcesses n

Replace n with the number of worker processes that you want to service the application pool.

For more information about configuring Web gardens, see MaxProcesses Metabase Property.

Related Information

For information on resource allocation, see Processor Affinity.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值