How to calculate the max number of worker threads in SQL Server?

  • I use 64-bit OS with two CPUs (each of them makes 7 logical processors) and with total number of logical processors equal to 14.

    When I run this code I get 2048

    SELECT max_workers_count FROM sys.dm_os_sys_info

    On the other way, when I use the formula below I get totally different number which is 672

    For a 64-bit operating system:
    Total available logical CPUs <= 4
    Max Worker Threads = 512
    Total available logical CPUs > 4
    Max Worker Threads = 512 + ((logical CPUs - 4)*16)

    Can you explain to me why I get different numbers? I tested it on another server and got exact same numbers for both cases.

  • someone has changed the default value to 2048 - unless someone experienced has tested and determined that this value is the best for your system MS recomendation is to set it to 0 (zero) so it sets it automatically to its default value based on bitness and cpu's

  • Check out this article by Pinal Dave. Basically, someone has manually changed max worker threads from 0 to 2048. If that person was kind enough to document when and why it was changed, great, otherwise you are going to need to investigate why this was done and whether changing this back to 0 is a better course of action.

    Setting max worker threads to a value other than 0 can lead to serious performance problems, however, there are scenarios where this is a good idea to resolve performance problems, but these are rare cases.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply