Assigning Processor Affinity

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

To efficiently use CPU caches on multiprocessor servers, you can configure application pools to establish affinity between worker processes and the processors, a feature known as processor affinity. Processor affinity forces worker processes to run on specific CPUs, and applies to all worker processes serving a particular application pool. You can also use processor affinity with Web gardens that run on multiprocessor computers where specific application pools are dedicated to specific clusters of CPUs.

Processor affinity typically yields the greatest performance benefits when you configure affinity on a computer that has eight or more processors. 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.

Table 3.8 shows which processors, on a computer with eight processors, are made available to worker processes that serve an application pool when various processor affinity masks are assigned.

Table 3.8   Sample Processor Affinity Mask Values for Binding an Application Pool to Specific Processors on an Eight-Processor Computer

Hexadecimal Mask (Binary Representation) Processor7 Processor6 Processor5 Processor4 Processor3 Processor2 Processor1 Processor1 0

0x2 (0010)

Yes

0x5 (0101)

Yes

Yes

0xD (1101)

Yes

Yes

Yes

0xF (1111)

Yes

Yes

Yes

Yes

0x11 (00010001)

Yes

Yes

0x1E

Yes

Yes

Yes

Yes

0xF0 (11110000)

Yes

Yes

Yes

Yes

0xFE

Yes

Yes

Yes

Yes

Yes

Yes

Yes

0xFF

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

1 Processor numbering begins with 0.

If you extend the table, a hexadecimal value of 0xFFFFFFFF (maximum value) allows all processors up to 32 to be available to worker processes that serve an application pool.

For more information about processor affinity mask settings, see the SMPProcessorAffinityMask Metabase Property and the SMPAffinitized Metabase Property. For more information about using the set command with Adsutil.vbs, see Processor Affinity.