Set Processor Affinity
Letzte Aktualisierung: August 2005
Betrifft: Windows Server 2003, Windows Server 2003 with SP1
On a multi-CPU server, you can configure application pools to establish affinity between worker processes and CPUs in order to take advantage of more frequent CPU cache hits. You can use processor affinity to control processors when applications place demands on system resources.
Processor affinity is used when it is necessary to continue processing an application that is tied to a subset of the hardware, so that transitions from one processor to another are minimized. You can establish affinity on a server that is supporting multiple applications so that a processor is dedicated to each application.
Consider the following when setting processor affinity to enable debugging of application pool failures:
By default, processor affinity is off, and the load is distributed across all available CPUs.
Processor affinity is used in conjunction with the processor affinity mask setting that is used to specify the CPUs.
The metabase property SMPProcessorAffinityMask is a hexadecimal number. The maximum value, FFFFFFFF, is equivalent to decimal 32, the largest number of processors currently allowed. The hexadecimal value, translated to binary, gives the processors that are connected to the worker process in the application pool. For example, the hexadecimal number FFFFFFFF translates to the binary number 1111 1111 1111 1111 1111 1111 11111111 . This means that all 32 processors are available to the worker processes in the application pool. If the hexadecimal value is 00000005, the binary value is 0000 0000 0000 0000 0000 0000 0000 0101, which means that processor 0 and processor 2 are connected to the worker processes in the application pool (processors are numbered from the right, beginning with 0).
Credentials: Membership in the Administrators group on the local computer.
Mode: The processor affinity feature of IIS 6.0 is available only when running in worker process isolation mode.
As a security best practice, log on to your computer using an account that is not in the Administrators group, and then use the Run as command to run IIS Manager as an administrator. At the command prompt, type runas /user:administrative_accountname mmc %systemroot%\system32\inetsrv\iis.msc.
To set processor affinity
Copy the following ADSI script into a text editor or word processor. The script (written in VBScript) enables and configures processor affinity.
set appPoolObj=GetObject("IIS://localhost/W3svc/AppPools/app pool name") ' Set the properties. Enable processor affinity for processors 0,1,2,3: appPoolObj.Put "SMPAffinitized", TRUE appPoolObj.Put "SMPProcessorAffinityMask", &H0000000F ' Save the property changes in the metabase: appPoolObj.SetInfo WScript.Echo "After: " & appPoolObj.SMPAffinitized & ", " & appPoolObj.SMPProcessorAffinityMask
In the text editor, change the value of the metabase property SMPProcessorAffinityMask to the hexadecimal value that corresponds to the CPU numbers of the CPUs that are used by the worker processes in the application pool.
Save the file with extension .vbs.
In the Run dialog box, type cmd and then click OK.
At the command prompt, run the script by typing: cscript //nologo filename.vbs where filename is the fully qualified path of the script file.
To ascertain that the metabase properties have changed, view the metabase properties in the Metabase.xml file to see if the values have been correctly set. To do so, open the Metabase.xml file in Notepad or another text editor. The default path to this file is systemroot\system32\inetserv\metabase.xml.
Möchten Sie an der Umfrage teilnehmen?