-
Notifications
You must be signed in to change notification settings - Fork 17
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
Custom keepalive on idle connections protected due to minimum pool size #55
Comments
An added difficulty here would be that the operation of telling the server that you are healthy likely means you have to effectively "acquire" the resource so that you can do whatever the resource needs to do to remain healthy. Otherwise, the |
Another alternative for keeping the min pooled resources healthy is to use time based |
In my specific case, I don't think that would help, since in this context there are no uses at all, so the resource would still be maintained while idle and not recycled. I am trying out a min pool size of zero and seeing if there is not any adverse effect on request latency. Realistically, the spikes we get are not very short where having a min pool size would be most useful. They are relatively longer lived (at least into the minute or more than a minute) where there will be enough time to ramp up the connection pool and persist all the resources as they will be in constant use. |
To perform a health check on all available resources, we will need a separate queue here. Lines 115 to 119 in da269d7
Then, at regular interval,
I don't think I want this in the main code-base. It will introduce unnecessary complexity. For your use case :- At the application level, you can keep acquiring connections one by one, and perform a health check on them. |
Greetings!
While diagnosing some db issues, we realized there may be a feature that could help mitigate or remove aborted connections.
The current state of our setup is:
On the surface, one would think there should never be any aborted clients because the pool idle timeout is lower than the db connection idle timeout. However, this is not the case because the pool (rightly) does not reap idle connections once you have reaped down to the pool minimum size.
This means that in periods of low activity, the db will end up aborting the pool idle connections because they are not being used but the pool is protecting them from reaping.
With a goal of reducing the number of db aborted clients to zero, I wonder if it is possible to allow some configuration in [1]. The goal being something like:
removeIdle
triggersIn my specific case using
mysql2
, this would probably be something likepooledObject.resource.ping()
.The end result would be that even in periods of low traffic, the pooled connections below the min threshold would keep themselves healthy by continually resetting the idle timeout on the server so that they are not closed due to lack of usage.
Would a feature like that be useful or accepted? If so, I may be able to work on a PR.
[1]
sequelize-pool/src/Pool.ts
Lines 263 to 277 in da269d7
The text was updated successfully, but these errors were encountered: