MongoDB副本设置缓慢的查询

我已经设置了6个服务器的MongoDB副本集,一切工作正常,数据被复制,没有问题。

当我从node.js直接连接到主服务器插入查询时,执行时间小于20毫秒,但是当我列出连接string( 文档 )中的所有服务器时,查询执行时间exception增加,范围从1.5秒到11秒。

我使用最新版本的本地mongodb包( https://github.com/mongodb/node-mongodb-native )

MongoDB版本是3.0.10。

连接string示例:

mongodb://s1,s2,s3,s4,s5,s6/my_database?replicaSet=repl 

我已经尝试了各种选项,如设置关注0(即使它的副本集configuration设置为1)和日记为真,但没有任何工作

即使我只使用2个服务器连接string执行时间仍然增加。

副本集configuration:

 { "_id" : "repl", "version" : 7, "members" : [ { "_id" : 0, "host" : "mongo1:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 2, "tags" : {}, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 1, "host" : "mongo2:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {}, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 2, "host" : "mongo3:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {}, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 3, "host" : "mongo4:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {}, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 4, "host" : "mongo5:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 1, "tags" : {}, "slaveDelay" : 0, "votes" : 1 }, { "_id" : 5, "host" : "mongo6:27017", "arbiterOnly" : false, "buildIndexes" : true, "hidden" : false, "priority" : 0.5, "tags" : {}, "slaveDelay" : 0, "votes" : 1 } ], "settings" : { "chainingAllowed" : true, "heartbeatTimeoutSecs" : 10, "getLastErrorModes" : { }, "getLastErrorDefaults" : { "w" : 1, "wtimeout" : 0 } } 

}