Run-time configuration options for threading

CPU groups

  • Configures whether threads are automatically distributed across CPU groups.
  • Default: Disabled (0).
Setting name Values
runtimeconfig.json N/A N/A
Environment variable COMPlus_Thread_UseAllCpuGroups 0 - disabled
1 - enabled

Minimum threads

  • Specifies the minimum number of threads for the worker thread pool.
  • Corresponds to the ThreadPool.SetMinThreads method.
Setting name Values
runtimeconfig.json System.Threading.ThreadPool.MinThreads An integer that represents the minimum number of threads
MSBuild property ThreadPoolMinThreads An integer that represents the minimum number of threads
Environment variable N/A N/A

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Threading.ThreadPool.MinThreads": 4
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <ThreadPoolMinThreads>4</ThreadPoolMinThreads>
  </PropertyGroup>

</Project>

Maximum threads

  • Specifies the maximum number of threads for the worker thread pool.
  • Corresponds to the ThreadPool.SetMaxThreads method.
Setting name Values
runtimeconfig.json System.Threading.ThreadPool.MaxThreads An integer that represents the maximum number of threads
MSBuild property ThreadPoolMaxThreads An integer that represents the maximum number of threads
Environment variable N/A N/A

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Threading.ThreadPool.MaxThreads": 20
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <ThreadPoolMaxThreads>20</ThreadPoolMaxThreads>
  </PropertyGroup>

</Project>