[SERVER-32380] established connections keep larger than connPoolMaxShardedConnsPerHost Created: 18/Dec/17  Updated: 11/Jan/18  Resolved: 21/Dec/17

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 3.2.17
Fix Version/s: None

Type: Question Priority: Minor - P4
Reporter: Adun Assignee: Kelsey Schubert
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-28822 Improve DBConnectionPool's growth sem... Closed
Participants:

 Description   

1. mongos run with: --setParameter connPoolMaxShardedConnsPerHost=10
2. use 24 mongo to connect mongos, 24 connections to mongos
3. run command, such as:

db.example.insert({'foo': 6})

from the mongos log, i found:

2017-12-18T12:01:48.525+0800 I NETWORK [conn21] Ending idle connection to host mongo1260/10.160.188.108:27017,10.160.189.108:27017,10.160.243.108:27017(with timeout of 0 seconds) because the pool meets constraints; 13 connections to that host remain open
2017-12-18T12:01:48.526+0800 I NETWORK [conn11] Ending idle connection to host mongo1260/10.160.188.108:27017,10.160.189.108:27017,10.160.243.108:27017(with timeout of 0 seconds) because the pool meets constraints; 12 connections to that host remain open

but I found there are still 22 connections from mongos to mongod(10.160.243.108), netstat command as below:

netstat -antp | grep ESTABLISHED | fgrep '10.160.243.108:27017' | awk '{print $5}' | sort | uniq -c

the 22 connections will always keep established. the output as below:

22 10.160.243.108:27017

so, may I have a wrong use on connPoolMaxShardedConnsPerHost ?

official docs about connPoolMaxShardedConnsPerHost:

Set the maximum size of the connection pools for communication to the shards. The size of a pool does not prevent the creation of additional connections, but does prevent the connection pools from retaining connections above this limit.



 Comments   
Comment by Kelsey Schubert [ 21/Dec/17 ]

Hi stutiredboy@gmail.com,

Thanks for reporting this behavior. Just earlier today, we improved this behavior in the master branch of MongoDB. Please review Sam's comment on SERVER-28822 for more details about the behavior you're observing and the changes made under this commit.

Kind regards,
Kelsey

Comment by Adun [ 18/Dec/17 ]

something missed, please replace:

3. run command, such as:

db.example.insert({'foo': 6})

to:

3. run command, such as:

db.example.count() // or db.example.find()

db.example.insert({'foo': 6})

Generated at Thu Feb 08 04:30:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.