如何判断 MongoDB 服务器上是否启用了 NUMA?

dre*_*ves 3 database-performance mongodb numa

我们的 mongodb 进程始终使用 >100% 的 CPU(这是在 Linode 上的 Ubuntu 64 位服务器上),我们正在努力提高性能。

我们发现的一个建议是 MongoDB 和 NUMA 不能很好地协同工作:http : //docs.mongodb.org/manual/administration/production-notes/#production-numa

我注意到它/proc/sys/vm/zone_reclaim_mode已经设置为 0 并且当前未安装 numactl。

我的问题:如何确定我们的服务器是否已经启用了 NUMA,以及我们是否应该按照上述链接中的建议使用以下命令启动 Mongo?

numactl --interleave=all /usr/bin/local/mongod
Run Code Online (Sandbox Code Playgroud)

这是以下内容/proc/cpuinfo(前 3 个部分被抑制,因为除了“处理器”行外,输出是相同的):

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2650L 0 @ 1.80GHz
stepping        : 7
microcode       : 0x70a
cpu MHz         : 1800.077
cache size      : 20480 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu de tsc msr pae cx8 sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl nonstop_tsc pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips        : 3600.15
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:
Run Code Online (Sandbox Code Playgroud)

Zip*_*oli 6

dmesg | grep -i numa
Run Code Online (Sandbox Code Playgroud)

这将告诉您您的服务器是否启用了 numa。

numactl -s 会告诉您是否在每个进程的基础上启用了 numa。

如果生产节点不应该使用 numa,那么您可能不应该使用。我建议您不要依赖于通过 numactl 将其关闭,您通常可以并且可能应该通常通过 BIOS 完全关闭 numa。

当我在做一些性能测试时,我已经看到 numa 在使用其他 Java 应用程序之前完全搞砸了服务器性能。看到它搞砸了像 Mongo 这样的 C/C++ 应用程序是令人惊讶的!

我想透露您的原始问题与您的问题不同。更改 numa 设置可能无法解决 100% cpu 问题。您可能会发现在消除 numa 卡后,您仍然有 100% 的 cpu 使用率,这将需要更多的诊断才能找到问题的根源(可能是单独的线程)。