Alex Rivera | Logout

MongoDb - Utilizing multi CPU server for a write heavy application

Asked 2010-12-10T09:28:32.773
22

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?

Edit
Report

1 Answer

18

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)

answered 2010-12-10T16:14:53.860

Your Answer