mongodb/mongo — pull request #359 by crumbjp (2013-01-18 06:05:15+00:00)
Title: Add configulations ("maxSpareConnPools" "connPoolTimeout") to mongos

I merged my previous patch to current master and confirmed its effect.

Sincerely,

=== origin ===
https://github.com/mongodb/mongo/pull/278

I'm Hiroaki Kubota from rakuten.co.jp. (hiroaki.kubota@mail.rakuten.com)

We are using the MongoDB with sharding structure.
And connect to the Mongo-Sharding from approximates 100 web servers
(that have 50 httpd process per server).
We also run the "mongos" on each web server.

Normally the number of the connections between "mongs" and "mongod" is approximates 55.
It's the good form !
But sometimes, the number of the connections raise to 300-350 on every web server.
And the "mongod" would refuse to connect from "mongos" more than 20000 as the limit of the mongod.

So we want to control the connection pool in the "mongos".

You already provide us the "maxConns" configuration.
However "maxConns" affects client side of the "mongos".

It's useless for us.

So we added some configurations to control "mongos" more minutely.

maxSpareConnPools
50 is default.
It's used in PoolForHost::getStaleConnections()

connPoolTimeout
1800 is default.
It's used in PoolForHost::StoredConnection::ok()
It's hard coded now.

Please review it and accept this pull-request.

Regards,

To be related to https://jira.mongodb.org/browse/SERVER-6726