Skip to content
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

Why maxIdleTimeMs defaults to zero? #1476

Closed
fredmaggiowski opened this issue Nov 21, 2023 · 2 comments
Closed

Why maxIdleTimeMs defaults to zero? #1476

fredmaggiowski opened this issue Nov 21, 2023 · 2 comments

Comments

@fredmaggiowski
Copy link

While investigating some issues about connection management in one of the services of my application I stumbled upon the maxIdleTimeMs default value which is set to 0 meaning that there is no idle limit and therefore connection may remain unused but still active.

I was wondering why is that so?

Reading this FAQ (specific to Node.js driver) I see there are concerns about the application being in charge of dealing with pool configuration tuning, so I guess the problem is to find an "ideal" time that works for most of the scenarios?

@alexbevi
Copy link
Contributor

alexbevi commented Jan 3, 2024

Hey @fredmaggiowski, and thanks for the question. There is nothing inherently wrong with an idle socket, and the driver doesn’t know when it might be needed again, so we decided not to close it after some arbitrary period of time (by default at least).

@alexbevi alexbevi closed this as completed Jan 3, 2024
@fredmaggiowski
Copy link
Author

Hi @alexbevi thanks for your reply

There is nothing inherently wrong with an idle socket, and the driver doesn’t know when it might be needed again

I agree, however depending on the server provider there may be a limit on available connections and keeping them open could cause issue.

... and the driver doesn’t know when it might be needed again, so we decided not to close it after some arbitrary period of time (by default at least).

I agree that there is no way for the driver to know this and now understand why the decision has been made.

Thanks!

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

No branches or pull requests

2 participants