-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Connectivity
-
None
The initial implementation of sessions has the server session pool associated with a MongoClient instance.
While this is perfectly logical, some applications create a new MongoClient instance for every operation (we don't recommend this but don't prohibit it).
If an application does open a new MongoClient instance for every operation, the result will be that a new server session is started for every operation. The server is never told that this server session is no longer needed so the server will end up with lots of unused sessions that won't get cleaned up until 30 minutes go by.
We should support this scenario more efficiently by implementing the server session pool at a lower level such that a server session pool can be shared by multiple MongoClient instances.