MongoDb-将多CPU服务器用于写繁重的应用程序 [英] MongoDb - Utilizing multi CPU server for a write heavy application

查看:39
本文介绍了MongoDb-将多CPU服务器用于写繁重的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在评估MongoDb用于我们的繁重应用程序...

当前,MongoDb使用单线程进行写操作,并且在执行写操作时也使用全局锁定...是否可以在多CPU服务器上利用多个CPU以获得更好的写性能?全局写锁定的解决方法是什么?

解决方案

因此,目前,简单的解决方案是分片.

是的,通常在服务器之间进行分片.但是,完全有可能在单个盒子上分片.您只需在不同端口上启动分片,然后为它们提供不同的文件夹. 这是一个示例配置,在一个盒子上有2个分片. >

MongoDB团队意识到这是一种低于标准的水平,从与他们的交谈中我知道他们正在寻找更好的方法来实现这一目标.

很明显,一旦在一个盒子上获得多个分片并增加了写入线程,就必须对磁盘IO保持警惕.以我的经验,我已经能够用一个写线程使磁盘饱和.如果您的插入/更新相对简单,则可能会发现额外的写线程没有任何作用. (Map-Reduces在这里是例外,分片在这里肯定有帮助)

I am currently evaluating MongoDb for our write heavy application...

Currently MongoDb uses single thread for write operation and also uses global lock whenever it is doing the write... Is it possible to exploit multiple CPU on a multi-CPU server to get better write performance? What are your workaround for global write lock?

解决方案

So right now, the easy solution is to shard.

Yes, normally sharding is done across servers. However, it is completely possible to shard on a single box. You simply fire up the shards on different ports and provide them with different folders. Here's a sample configuration of 2 shards on one box.

The MongoDB team recognizes that this is kind of sub-par, and I know from talking to them that they're looking at better ways to do this.

Obviously once you get multiple shards on one box and increase your write threads, you will have to be wary of disk IO. In my experience, I've been able to saturate disks with a single write thread. If your inserts/updates are relatively simple, you may find that extra write threads don't do anything. (Map-Reduces are the exception here, sharding definitely helps there)

这篇关于MongoDb-将多CPU服务器用于写繁重的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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