无法在 AWS c5.18xlarge 72 vpu 上使用 .NET 中的所有处理器
Unable to use all processors in .NET on AWS c5.18xlarge 72 vpu
如何在 AWS c5.18xlarge 实例上使用我的 .net 应用程序中的所有虚拟处理器?目前,该应用程序在 72 个虚拟处理器中占据了 36 个 (50%)。
在 AWS 上,我启动了一个 c5.18xlarge 实例,标榜有 72 个虚拟处理器。
- 当我 运行 .NET 应用程序时,任务管理器显示最大负载为 50%。
- 当我查询Environment.ProcessorCount时,它returns36.
- 当我打开开始 > "System Information" > 系统摘要时,我可以看到 "Processor: Intel(R) Xeon(R) Platinum 8124M ... 18 cores, 36 logical processors".
的 2 个条目
- 但是,当我 运行 2 个单独的 .net 应用程序时,我达到了 100% 负载。
- 最初我虽然它可能是默认任务调度程序中的最大值,但即使我显式创建 72 个线程,它仍然达到 50%。
示例应用程序 1:
Parallel.For(0, 1000, i =>
{
var w = new Stopwatch();
w.Start();
Console.Write("#");
while (w.ElapsedMilliseconds < 1000);
});
示例 2:
for (var i = 0; i < 72; i++)
{
new System.Threading.Thread(() =>
{
var w = new Stopwatch();
w.Start();
Console.Write("#");
while (w.ElapsedMilliseconds < 5000);
}).Start();
}
我正在使用 Roslyn/C# 交互。
我找到的最匹配的文章没有帮助..
想通了..
要使 .NET 能够使用所有 NUMA 节点,请将以下内容添加到您的 app.config:
<configuration>
<runtime>
<Thread_UseAllCpuGroups enabled="true"/>
<GCCpuGroup enabled="true"/>
<gcServer enabled="true"/>
</runtime>
</configuration>
现在它正以 100% 的速度鸣叫。
来源:
如何在 AWS c5.18xlarge 实例上使用我的 .net 应用程序中的所有虚拟处理器?目前,该应用程序在 72 个虚拟处理器中占据了 36 个 (50%)。
在 AWS 上,我启动了一个 c5.18xlarge 实例,标榜有 72 个虚拟处理器。
- 当我 运行 .NET 应用程序时,任务管理器显示最大负载为 50%。
- 当我查询Environment.ProcessorCount时,它returns36.
- 当我打开开始 > "System Information" > 系统摘要时,我可以看到 "Processor: Intel(R) Xeon(R) Platinum 8124M ... 18 cores, 36 logical processors". 的 2 个条目
- 但是,当我 运行 2 个单独的 .net 应用程序时,我达到了 100% 负载。
- 最初我虽然它可能是默认任务调度程序中的最大值,但即使我显式创建 72 个线程,它仍然达到 50%。
示例应用程序 1:
Parallel.For(0, 1000, i =>
{
var w = new Stopwatch();
w.Start();
Console.Write("#");
while (w.ElapsedMilliseconds < 1000);
});
示例 2:
for (var i = 0; i < 72; i++)
{
new System.Threading.Thread(() =>
{
var w = new Stopwatch();
w.Start();
Console.Write("#");
while (w.ElapsedMilliseconds < 5000);
}).Start();
}
我正在使用 Roslyn/C# 交互。
我找到的最匹配的文章没有帮助..
想通了..
要使 .NET 能够使用所有 NUMA 节点,请将以下内容添加到您的 app.config:
<configuration>
<runtime>
<Thread_UseAllCpuGroups enabled="true"/>
<GCCpuGroup enabled="true"/>
<gcServer enabled="true"/>
</runtime>
</configuration>
现在它正以 100% 的速度鸣叫。
来源: