Wenxiang Wu
Wenxiang Wu

Reputation: 93

Are there any benefits/pitfalls for running multiple MongoDB shards within a single server?

I am currently running a traditional MySQL Master/Slave set up with about 90GB of data. The traffic on our application is increasing rapidly, and already this set up is showing signs of slowing down. I would very much love to try out MongoDB and I am especially excited with the auto-sharding feature.

However, I currently have only 2 (dedicated) DB servers at my disposal, and definitely one of them has to be used for replication. So here is my question:

If I run multiple instances of MongoDB as shards within the same server, will I actually reap the benefits of having smaller sharded data sets? Or will this instead cause the performance to tank due to increased load / memory requirements?

Upvotes: 5

Views: 2386

Answers (3)

Theo
Theo

Reputation: 132862

Kristina Chodorow of MongoDB has a series of blog posts about sharding and replica sets in MongoDB. She mentions that you almost never want sharding, at least not until you've tried replica sets. Read her series on replica sets too: part 1, part 2, part 3

Upvotes: 6

Gates VP
Gates VP

Reputation: 45287

Start with a 2-node replica set and see if Mongo doesn't give you better insertion / update speeds. If the writes are faster (which they can be), then you'll be able to handle more load. Handling more load may very well be all you need in terms of improving performance.

The only reason for needing sharding within a server is if you somehow need to hammer in more writes and you're not already maxing out your IO (that's pretty rare).

I would suggest simply starting with a move to Mongo replica sets (Master/Slave is supported, but "less good").

Upvotes: 1

Justin Dearing
Justin Dearing

Reputation: 14928

Why not run shard across the two servers, and have a second mond instance on each server that replicates the other shard? That would give you sharding and redundancy. If one server went down, the other server would have the replica.

Sharding might be useful if each mongod instances data folder was on a different disk, or if the entire data set fit into memory and you have multiple cores.

Upvotes: 2

Related Questions