-
Notifications
You must be signed in to change notification settings - Fork 342
Allow to customize the interval the connection reaper runs #442
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
Comments
Did you change Because a connection string setting is per-connection-pool but the reaper is currently global, I'm leaning towards automatically changing the reaper interval based on the lowest |
Just found an old comment of mine where I tried that and it had negative repercussions on the client-side (so it may not be viable): #211 (comment) |
I'm wondering if this was a premature optimisation. Since most applications only have one connection pool, it should be fine to have one reaper per pool, and set its frequency based on |
If ConnectionIdleTimeout is set to a low value for a particular connection pool, clean up connections in that pool more frequently. (Since most applications have just one connection string, switching from a global reaper Task to a per-pool Task won't create extra background tasks for most applications.) Since the reaper interval is now set per connection pool, the DebugOnlyTests are no longer necessary (and can be executed with the other ConnectionPool tests).
Improved in 0.36.1. |
@bgrainger Just to make sure I understand how it works now: If Correct? |
If Examples:
|
Makes sense. Thanks! |
Short version: I'd like to set my ConnectionIdleTimeout to 10 seconds, but the reaper currently runs every 60 seconds, which causes lots of connections to being left open for longer than needed.
Long version: I have 900 nodes connecting to a mariadb instance with 64 CPU, and even though each node opens up to 10 connections, and eventually closes them, once we past 3000 connections, CPU started to increase exponentially. 900 nodes had 30% cpu usage, 950 had 70% cpu, 1000 nodes went to 100% and brought down the server. The nodes do the same work, so that didn't make sense.
After spending an hour with AWS support, they recommended closing the idle connections and that solved the problem.
I set a a 10 sec idle timeout, but with 1800 connections, 600 of them are still waiting for longer than necessary. Being able to run the reaper more frequently would allow me to keep using the connection pool, but keep connections open for less time.
The default of 60 seconds is enough for most applications, . But it would be nice to have something like
ConnectionIdleReaperInterval=180
by default and be able to change that per app.The text was updated successfully, but these errors were encountered: