Hi,
We're using mongo 3.4 and have recently started to use mongos in production environment.
One of the issues it introduced looks like this. We use go mongo driver with socket timeout configured, so if a requests takes too long, a connection is closed. If there is a lot of timeouts, then of course mongod still processes some extra requests, but at least the number of incoming connections is limited to (number of client nodes)*(mongo connection pool size on each node).
Now, with mongos we observed that when a 'client -> mongos' connection is closed, a 'mongos -> mongod' connection remains open. So, with new requests following the ones that timed out, the number of open connections to mongod nodes spiked. That's bad.
It there a common way to combat this effect?
As far as I understand, it is a common practice to use timeouts on mongo clients, so this issue must be common as well.
There is a '--maxConns' setting for mongos, but this applies for incoming connections, so if those a closed by a client, this limit seems not to be the remedy.
The only client-side solution I can think of is not to close connections in case of a timeout, but this requires some heavy meddling with mongo driver, so I'd really like to avoid it if I can.
Any insight on the subject will be much appreciated.