-
Notifications
You must be signed in to change notification settings - Fork 286
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
Add Pool Idle Timeout to control connection pool #343
Comments
FYI Npgsql has this option under the name |
@David-Engel wouldnt simply increasing the Min Pool Size help? |
@saurabh500 yeah, Connection Idle Lifetime and Pruning Interval are what control Npgsql's connection pool pruning mechanism; once you have more than Min Pool Size idle connections in the pool, these two parameters determine how/when connections get pruned. The default value for this is 300 (5 minutes), but users can e.g. dial it down if they want more aggressive pruning; that would reduce the overall idle connection strain on the server, but can cause more thrashing if new physical connections need to be created because the previous ones were pruned etc. Note that Npgsql doesn't track specific connections for pruning reasons. In other words, we don't care if a single connection was idle for 5 minutes, or different connections came in and out of the pool but 1 was always idle in there. We simply sample the pool status every given interval, and if we see a constant idle situation for Connection IdleL Lifetime, we start pruning etc. |
@saurabh500 Examples: |
From an internal email thread asking about ADO.NET connection pooling, we have this feature request from an ISV:
Is your feature request related to a problem? Please describe.
Right now, connections returned to the pool are automatically managed and closed/disposed from the pool after 4-8 minutes of idle time. This request is to be able to configurable the amount of time a connection can be idle in the pool before it is closed. "Pool Idle Timeout".
Describe the solution you'd like
A new connection string setting, "Pool Idle Timeout" which defines the number of seconds a connection can be idle in the pool before it is automatically closed.
Describe alternatives you've considered
Letting the 4-8 minute auto close do its thing. Using ClearPool() and ClearAllPools().
The text was updated successfully, but these errors were encountered: