Share via


Processor Affinity

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

Important

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

On multi-CPU servers, application pools can be configured to establish affinity between worker processes and multiple CPUs to more efficiently use CPU caches. Processor affinity is used in conjunction with the processor affinity mask setting to specify CPUs.

You can set processor affinity from the command line by using the set command with Adsutil.vbs. To set processor affinity, configure the SMPAffinitized and SMPProcessorAffinityMask metabase properties. Assigning processor affinity involves these steps:

  • Enable processor affinity. Set the SMPAffinitized metabase property to true, which indicates that a particular worker process assigned to an application pool can also be assigned to a specified CPU.

  • Assign processor affinity. Set the SMPProcessorAffinityMask metabase property, which configures a hexadecimal processor mask that indicates which CPU the worker processes in an application pool are bound to.

Procedures

To enable processor affinity for an application pool

  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/SMPAffinitized TRUE

To assign processor affinity by binding an application pool to a specified processor

  • At a command prompt, type:

    cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AppPools/ApplicationPoolName/SMPProcessorAffinityMask MaskValue

    Replace MaskValue with the hexadecimal value that binds the application pool to the appropriate processor or processors. See Table 3.8 for sample hexadecimal mask values.

For example, if you want to bind the worker processes that serve your FinanceAppPool to processors 0, 1, 2, and 3 of an eight-processor computer, type the following command:

cscript %SystemDrive%\Inetpub\AdminScripts\adsutil.vbs set W3SVC/AppPools/FinanceAppPool/SMPProcessorAffinityMask 0xF