[JAVA-3628] Question: is connectionPoolSetting for single mongos or whole cluster? Created: 17/Feb/20  Updated: 23/Mar/20  Resolved: 23/Mar/20

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Xiao Tang Assignee: John Stewart (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I am a server-side developer, working on a project which uses a mongo cluster as persistent database.
I have a question for https://mongodb.github.io/mongo-java-driver/3.8/javadoc/com/mongodb/connection/ConnectionPoolSettings.html
It said `to a MongoDB server`
But what if I have a connectionString like following one

mongodb://user:pwd@mongos1:port,mongos3:port,mongos3:port,mongos4:port,mongos5:port,mongos6:port/admin?readPreference=secondaryPreferred

A mongodb sharded cluster which has 6 mongos instance.

Question:
Is the connectionPoolSetting related to one mongos server? or related to all mongos servers?
E.g. if we have maxSize = 10 in this setting, does it mean single client has max connection pool = 10 for single mongos server (max pool = 60 for my 6 mongos cluster)? Or max connection pool = 10 for the whole cluster no matter how many mongos server we have?

 
 



 Comments   
Comment by John Stewart (Inactive) [ 09/Mar/20 ]

tangxiao.dalian@gmail.com Yes, that is correct.

Comment by Xiao Tang [ 08/Mar/20 ]

@John Stewart
Thanks for your reply~!
I am so sorry that I just noticed your answer now...
So for the case that there are 6 mongos instances, application server will have maxSize=10 for each mongos servers~

Comment by John Stewart (Inactive) [ 24/Feb/20 ]

tangxiao.dalian@gmail.com Thanks for your questions. Connection pooling is for a single server. So if you set maxSize = 10, this means the connection pool will have up to 10 connections available for a single mongos server. 

Generated at Thu Feb 08 09:00:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.