MongoDB是否以某种方式受限于单个内核? [英] Is MongoDB somehow limited to a single core?

查看:63
本文介绍了MongoDB是否以某种方式受限于单个内核?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我以某种方式对MongoDB进行了错误配置,但是即使在重负载下,我也看不到使用多个内核.例如,top当前显示:

Perhaps I have misconfigured MongoDB somehow, but even under heavy load I don't see it using more than one core. For example, top is currently showing:

Tasks: 145 total,   1 running, 144 sleeping,   0 stopped,   0 zombie
Cpu0  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Cpu3  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  41182768k total, 40987476k used,   195292k free,   109956k buffers
Swap:  2097144k total,  1740288k used,   356856k free, 28437928k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                         
16297 mongod    15   0  521g  18g  18g S 99.8 47.2   2929:32 mongod                                                                           
    1 root      15   0 10372  256  224 S  0.0  0.0   0:03.39 init      

我可以做些什么使Mongo更有效地使用其他内核吗?如果相关的话,我目前正在运行大型M/R,这似乎使许多读取查询处于等待"模式.

Is there something I can do to get Mongo to use the other cores more effectively? If it's relevant, I currently have a big M/R running which seems to have put a lot of read queries in "waiting" mode.

推荐答案

MongoDB可以使多核计算机上的所有内核饱和以进行读操作,但对于写操作和map-reduce而言,MongoDB只能在每个mongod进程中使用单个内核

MongoDB can saturate all cores on a multi-core machine for read operations, but for write operations and map-reduce MongoDB can only utilize a single core per mongod process.

单核MapReduce的局限性是由于MongoDB使用Javascript解释器造成的.这应该在将来修复,但是在此期间,您可以使用Hadoop执行MapReduce并将结果集存储在MongoDB数据库中.

The limitation for single-core MapReduce is due to the Javascript interpreter that MongoDB utilizes. This is something that is supposed to be fixed in the future but in the interim you can use Hadoop to execute the MapReduce and store the result set in your MongoDB database.

另一个看到混合结果的选项是为实例上的每个核心运行一个mongod进程,除非将它们配置为在分片设置中运行,否则不会提高单个数据库的性能.

Another option which has seen mixed results is to run a single mongod process for every core on the instance this will not increase performance for a single database unless they are configured to run in a sharded setup.

这篇关于MongoDB是否以某种方式受限于单个内核?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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