Skip to content

Add option to allow disabling the MongoClient cache. #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

romanb
Copy link

@romanb romanb commented May 27, 2025

In a server environment where the mongo-jdbc driver is used to connect to a variable number of customer databases to run queries at varying frequencies, it is not desirable to keep the MongoClients alive/open across JDBC connections, especially since every MongoClient comes with a background server monitoring thread.

This PR adds an option to disable the mongo client cache, so that the client is owned by the JDBC connection and closed together with it, as was the case before the cache was introduced in #260.

In a server environment where the mongo-jdbc driver is used to connect
to a variable number of customer databases at varying frequencies, it is
not desirable to keep the MongoClients alive/open across JDBC
connections, especially since every MongoClient comes with a background
server monitoring thread.
@romanb romanb requested a review from a team as a code owner May 27, 2025 08:44
@nbagnard
Copy link
Collaborator

Hi Roman,

We have an item in our backlog already for addressing this.
The difference is that we don't plan to go exactly as you are suggesting, but I think it would address your problem.
We want to close the clients and clear the cache once there is no more linked connections.
The work is not currently on our roadmap, but I will bring it up at our next stand up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants