The affinity mask option, available through sp_configure, lets you control which processors SQL Server uses. If you use the affinity mask option on a machine that uses Intel's Hyper-Threading technology, you might get unanticipated behavior. If your machine has four physical processors and you enable Hyper-Threading, the OS will see eight logical processors. SQL Server assigns a separate User Mode Scheduler (UMS) for each processor in the system. The UMS works with the OS to schedule SQL Server threads. Normally, each processor has one UMS.

Table 1 shows a map of logical processor number to physical processor. The execution context on physical processor 0 serves logical processors 0 and 4. Setting affinity mask equal to a value of 00010001 tells SQL Server to use logical processors 0 and 4, which are using the same physical processor. In this case, you might think you were setting affinity mask to use two processors when you're in fact using a single physical processor. Affinity mask is an advanced setting that you don't need to change for most installations. However, recognizing the implications of Hyper-Threading is important if you take advantage of the affinity mask option.

End of Article




You must log on before posting a comment.

If you don't have a username & password, please register now.

Reader Comments

I expected a much more detailed analysis of the impact of Hyper-Threading on SQL Server since there have been performance issues identified with hyper-threading slowing SQL Server 7

e911chet

Article Rating 1 out of 5

How can you guarantee that affinity on a 4 proc machine will always be the same as you stated?

0-0 1-1 2-2 3-3 4-0 5-1 6-2 7-3

Per Intel, AMD...etc...Affinity is not always as such and could be in the format

0-0 1-0 2-1 3-1 4-2 5-2 6-3 7-3

johnmbarr

Article Rating 3 out of 5