[JAVA-1170] How is the connection pooling managed within the latest driver version Created: 17/Apr/14  Updated: 11/Sep/19  Resolved: 17/Apr/14

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

Type: Task Priority: Major - P3
Reporter: Jeff Mitchell Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

How are connection pools segregated for the mongoClient. i.e. per server:port with authentication details ?



 Comments   
Comment by Jeff Mitchell [ 17/Apr/14 ]

Jeff,

Thanks this confirms the assumption that we have one pool per client and would use different clients for different connection reqs.

This issue can be closed (I couldnt see any close option so I assume you guys close them!)

Jeff.

Comment by Jeffrey Yemin [ 17/Apr/14 ]

Hi Jeff,

A MongoClient instance can represent either a direct connection to a single MongoDBServer, a connection to an entire replica set (discovering all the servers), or a connections to one or more mongos servers.

The instance maintains a pool for each server:port that is is managing. But the credentials are the same for all the connections. If you want to communicate with MongoDB using different sets of credentials, create a new MongoClient for each set.

There are a number of options in MongoClientsOptions that control the pool behavior. They are pretty clearly indicated as such in the Javadoc.

Regards,
Jeff

Comment by Jeff Mitchell [ 17/Apr/14 ]

Am I correct in assuming that the client would create separate pools for different server:port:credentials? Or does one client support only one pool, so additional client instances would be required for talking to different servers or via different authenticated users ?

Do any of the connection options affect how pooled connections are managed ?

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