MongoDB with same throughput

389 Views Asked by At

I'm testing mongodb starting with one node, then 2 datanodes (1 master, 1 config-server and 2 masters), then 4 datanodes (1 master, 1 config-server, 4 masters) and with 16 datanodes (same configuration as before with 16 masters). I noticed the throughput is the same indipendently from the number of nodes: with 30 threads (using YCSB) I obtained about 6000 ops/sec with 2, 4 or 16 nodes!! It's normal? Or there are some parameters to set??

Thanks for your replies!

2

There are 2 best solutions below

1
On

You may have a non balanced shard configuration based on the value of the keys. This shard key isn't likely optimal with YCSB:

shard key: { "_id" : 1 }

You may instead want to try hash sharding like:

shard key: { "_id" : "hashed" }

One way you can tell is to run mongostat on each shard and see if you are getting a nice spread of OPS. If not, then iterate on shard keys until you do. YCSB may need to be altered with this in mind.

0
On

I was able to add more mongos on the network. So now I have 4 mongod and 4 mongos. I connect to each mongos with a different client, but it seems that one mongos works really hard, the second one works but not so hard and the other two doesn't work at all (cpu utilization is around 10%). My question is, how mongos' work? I mean, the mongos cluster decide wich mongos has to manage the load/connection? If I connect from a client to a mongos, it could happen that mongos redirect the request to another mongos? Thanks!