How many connections does each mongos need?
In a sharded configuration will have 1 incoming connection from the client but may need 1 outgoing connection to each shard (possibly mongos times the number of nodes if the shard is backed by a replicaset).
This means that the possible number of open connections that a server requires could be (1 + (N*M) * C)where N = number of mongos shards, M = number of replicaset nodes, and C = number of client connections.
Why does mongosnever seem to give up connections?
mongos uses a set of connection pools to communicate to each shard (or shard replicaset node). These pools of connections do not currently
constrict when the number of clients decreases. This will lead to a possibly large number of connections being kept if you have even used the mongos
instance before, even if it is currently not being used.
How can I see the connections used by mongos ?
Run this command on each instance: mongos
db._adminCommand("connPoolStats" );
2.设置了sockettimeout=300000没能生效:http://www.mongodb.org/display/DOCS/Connections,单位应该是ms,不行的话换sockettimeoutms试试~~
应该就是这个原因了,是sockettimeout的单位是tick,不是毫秒。
3.刚开始全部启动测试时,很有可能崩掉一大片
4. 社区给我的答案,没试过
5.2012-04-11补充,对mongo重新做了些测试,发现有两种情况会导致,一个连接超时,默认是30s,另外一个是连接的关闭,不要轻易调用connect.close
本文探讨了MongoDB中mongos实例所需的连接数计算方式,包括客户端连接、到各个分片的连接以及副本集节点的连接。同时,文中还讨论了连接池的工作原理、如何查看连接使用状态以及连接超时设置等问题。

1845

被折叠的 条评论
为什么被折叠?



