The SMPProcessorAffinityMask property is a bitmask provided as a hexadecimal number that represents the CPU you want to assign to the pool. You can also assign a pool to run on more than one processor, if your system has multiple processors. The following command configures a pool to run on processors 0 and 2:
cscript SystemDrive\InetpubAdminScripts\adsutil.vbs
set W3SVC/AppPools/
ApplicationPoolName/
SMPProcessorAffinityMask 0x5
The Internet Information Services (IIS) 6.0 Resource Kit (http://www.microsoft.com/downloads/details.aspx?familyid=80a1b6e6-829e-49b7-8c02-333d9c148e69&displaylang=en) has a table of processor hex values in Chapter 3, "Running IIS 6.0 as an Application Server."
Web Gardens
IIS 6.0 can perform yet another trick in relation to application poolsits Web garden feature lets you designate that an application pool will contain more than one worker process. When so configured, IIS 6.0 will create an instance of w3wp.exe for each request up to the number of worker processes you specified for the pool. For example, if you set an application pool to have three worker processes, after three requests, you'll see three instances of W3wp running on your server, all delivering the same content. IIS 6.0 makes subsequent connections in a round-robin fashion to the worker processes in the Web garden. Although Web gardens don't have session affinity per se, IIS 6.0 routes all the traffic from one connection to the same worker process. The worker process stores the session information, Secure Sockets Layer (SSL) secret key, and authentication information until the connection is terminated or the worker process is recycled.
Web gardens aren't widely used, partly, I think, because IIS 6.0 performance and reliability are generally good to excellent without them and partly because people don't know what kind of applications are likely to benefit from using them. I've been having trouble finding examples of real-world installations in which this feature clearly benefits the application. If you know of any, please write to me. Nevertheless, here are a couple of examples.
A Web garden might be useful when your application uses a component that has a built-in restriction. For example, if you have a database connection object that accepts only 10 connections, you can enable n worker processes to provide 10 * n connections.
Another and more likely scenario is a database connection "blocking" an application. The application makes a request to the database that takes some time to render. The thread (i.e., the working unit for executing code on the CPU) that makes the request is now tied up waiting on that request and isn't available for any other task. Thus, the available pool of worker threads is reduced by 1. If requests come in faster than the database can process them, your application can become "thread starved." This scenario would benefit from a Web garden because each process in the Web garden has its own dedicated thread pool.
cscript %SYSTEMROOT%\Inetpub\AdminScripts\adsutil.vbs
set W3SVC/AppPools/LogEventOnRecycle 0xff
activenet April 13, 2004