为什么我的.Net应用程序仅使用单个NUMA节点? [英] Why is my .Net app only using single NUMA node?

查看:195
本文介绍了为什么我的.Net应用程序仅使用单个NUMA节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台服务器,其中有2个NUMA节点,每个节点有16个CPU.我可以看到任务管理器中的所有32个CPU,前2行中的前16个(NUMA节点1),后2行中的下16个(NUMA节点2).

I have a server with 2 NUMA node with 16 CPUs each. I can see all the 32 CPUs in task manager, first 16 (NUMA node 1) in the first 2 rows and the next 16 (NUMA node 2) in the last 2 rows.

在我的应用程序中,我使用Thread.Start()启动64个线程.当我运行该应用程序时,它占用大量CPU,只有前16个CPU处于繁忙状态,其他16个CPU处于空闲状态.

In my app I am starting 64 threads, using Thread.Start(). When I run the app, it's CPU intensive, only the first 16 CPUs are busy, the other 16 CPUs are idle.

为什么?我经常使用Interlocked.Increment().这可能是原因吗? 有什么方法可以在特定的NUMA节点上启动线程?

Why? I am using Interlocked.Increment() a lot. Could this be a reason? Is there a way I can start threads on a specific NUMA node?

推荐答案

除了gcserver之外,我们还应启用

In addition to gcserver we should enable GCCpuGroup and Thread_UseAllCpuGroups so the config should be more like:

<configuration
   <runtime>
      <gcServer enabled="true"/>
      <GCCpuGroup  enabled="true"/>
      <Thread_UseAllCpuGroups  enabled="true"/>
   </runtime>
</configuration>

GcCpuGroup启用多个CPU组的垃圾收集,而Thread_UseAllCpuGroups启用运行时在所有CPU组之间管理线程分配.

GcCpuGroup enables Garbage Collection for multiple CPU groups and Thread_UseAllCpuGroups enables manage thread distribution across all CPU groups for the runtime.

这篇关于为什么我的.Net应用程序仅使用单个NUMA节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆