【问题标题】:Trying to use Thread_UseAllCpuGroups in a .Net Core app尝试在 .Net Core 应用程序中使用 Thread_UseAllCpuGroups
【发布时间】:2021-03-10 22:05:09
【问题描述】:

我正在尝试在我的 .Net Core 应用程序中使用 Thread_UseAllCpuGroups。将框架与 Web.Config 中的设置一起使用,我在 3990x 处理器上使用所有 128 个 CPU 没有问题,但在将其移至 .Net Core 时,它​​仅使用 64 个内核(1 组)。

我的项目文件部分有以下几行:

    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UseWPF>true</UseWPF>
    <TieredCompilation>true</TieredCompilation>
    <TieredCompilationQuickJit>false</TieredCompilationQuickJit>
    <TieredCompilationQuickJitForLoops>false</TieredCompilationQuickJitForLoops>
    <gcServer>true</gcServer>
    <gcAllowVeryLargeObjects>true</gcAllowVeryLargeObjects>
    <GCHeapAffinitizeRanges>0:1-64,1:1-64</GCHeapAffinitizeRanges>
    <Thread_UseAllCpuGroups>true</Thread_UseAllCpuGroups>
    <GCCpuGroup>true</GCCpuGroup>
    <ServerGarbageCollection>true</ServerGarbageCollection>
  </PropertyGroup>

我看到有关设置环境变量的帖子,但我并不需要这种能力,只针对特定项目。与使用框架的详细信息(完美运行)相比,寻找有关 .Net Core 和处理器组的信息的信息有限。

我的理解是这些类型选项从 web.config 的运行时部分移动到项目文件,但我做错了。

如果我有任何关于我在哪里绊倒的想法,我将不胜感激。

【问题讨论】:

    标签: c# multithreading asp.net-core


    【解决方案1】:

    .NET 5+ 和 .NET Core 版本的运行时配置设置已移至runtimeconfig.json 或环境变量,如Microsoft's documentation 中所述。

    我发现这样做的唯一方法是设置环境变量:

    set complus_GCCpuGroup=1
    set COMPlus_Thread_UseAllCpuGroups=1
    

    只有在进程开始之前设置变量的值才有效。

    还有an issue opened on the dotnet/runtime GitHub page

    【讨论】:

    • 您是否有一个运行示例来显示它是否有效。在我的机器上,我无法使用 128 个内核。
    猜你喜欢
    • 1970-01-01
    • 2019-01-26
    • 1970-01-01
    • 1970-01-01
    • 2020-04-26
    • 2020-05-21
    • 2017-06-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多