我们的mongodb进程始终如一地使用我们的CPU(这是在Linode上的一个Ubuntu 64位服务器上)的100%,并且我们正在大力改进性能。
我们发现的一个build议是,MongoDB和NUMA不能很好地协同工作: http : //docs.mongodb.org/manual/administration/production-notes/#production-numa
我注意到/proc/sys/vm/zone_reclaim_mode已经设置为0,并且numactl当前没有安装。
我的问题:我如何知道我们的服务器是否已经启用了NUMA,以及我们是否应该按照以上链接的build议来启动Mongo,并使用以下命令?
numactl --interleave=all /usr/bin/local/mongod
这是/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:
dmesg | grep -i numa
这会告诉你,如果你的服务器numa启用。
numactl -s会告诉你numa是否在每个进程的基础上启用。
如果生产节点不应该使用numa,那么你可能不应该使用numa。 我会build议,而不是依靠closures通过numactl,你可以也可能通常应该通过BIOS完全closuresnuma。
当我正在做一些性能testing时,我已经看到numa完全废弃了其他Java应用程序的服务器性能。 看到它搞砸了像Mongo这样的C / C ++应用程序是令人惊讶的!
我想透露你的原始问题,与你的问题不同。 更改numa设置可能无法解决您的100%CPU问题。 你可能会发现在消除numa卡之后,你仍然有100%的CPU使用率,这将需要更多的诊断来解决问题的根源(也许是单独的线程)。