We have a sharded cluster with 3 shards, and about 15 app servers that run mongos
.
When I look at the mongos
logs, I see a couple messages every second about connections being opened and then closed. The numOpenConns
looks like it goes up to about 16… then it seems like the connections start to get ended. Is there any advantage of increasing the minimum pool size to something like 15 so the connections aren’t constantly created and ended? How would I do this in the mongos
client?
{"t":{"$date":"2023-02-09T11:14:55.664-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"d-db1:27017","numOpenConns":8}}
{"t":{"$date":"2023-02-09T11:15:00.082-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"h-db1:27017","numOpenConns":8}}
{"t":{"$date":"2023-02-09T11:15:00.086-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"h-db1:27017","numOpenConns":7}}
{"t":{"$date":"2023-02-09T11:15:06.443-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"d-db1:27017","numOpenConns":7}}
{"t":{"$date":"2023-02-09T11:15:06.463-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"d-db1:27017","numOpenConns":6}}
{"t":{"$date":"2023-02-09T11:15:07.664-05:00"},"s":"I", "c":"CONNPOOL", "id":22567, "ctx":"TaskExecutorPool-0","msg":"Ending idle connection because the pool meets constraints","attr":{"hostAndPort":"d-db1:27017","numOpenConns":5}}