-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Suitable values for poolSize, poolIdleTimeout and reapIntervalMillis #1222
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
I believe it refers to how long a client will stay connected and idle while available in the pool. If you acquire a client from the pool, it will never time out and be returned. So…
… fix those! Bluebird’s resource management might help. |
Thanks for the tip. I believe I had one particular code path that gets hit rarely, so over time I was losing connections. Another useful tool in tracking that down was postgres' query:
Which lists all open connections, thus helped me find ones that shouldn't be open after they've been used. While I'm at it though it would be best to make sure connection pool setup is optimal. |
Facing the same issue, I have tried to decrease poolIdleTimeout to 2000 ms, but it's not efficient : when you have connexion leaks in a hot path, the only way is to find & fix them. The main problem imho is still that pg.connect dont return error when the pool is exhausted, see #1006 |
I added this to the docs subtask to document stuff about leaky connections. |
why are connections leaking?, isnt it supposed to be returned to the pool with the callback "done"?
|
@jacobbogers Is that a bug report? You’ll need to provide more details. |
@brianc @charmander …Am I missing where node-pg-pool accepts a config parameter named If not, it looks like the current property should be |
Right. Is there documentation contradicting that? |
There’s a connection timeout option now to address #1222 (comment), and |
This is more of a question than an issue.
I'm using node-postgres and have had some issues with the connection pool getting exhausted (I think mainly due to connection leaks). I'm trying to find out the optimal values for pool size and timeouts. Let's say I expect to have 1000 concurrent users and most users will be making requests that result in db requests. My database server has limited resources with 1 CPU and 2GB or RAM.
What would be the ideal values for these settings? I'm currently using this:
Also I'm a question about the
poolIdleTimeout
. The comments in the code says:Does this mean the amount of time before the connection is closed and returned to the pool, or the connection is closed and removed from the pool, thus decreasing pool size?
The text was updated successfully, but these errors were encountered: