-
Notifications
You must be signed in to change notification settings - Fork 25
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
Too many database connections are being opened #3316
Comments
Could be related to #1809 |
Indeed, we're seeing this on the production machine again and it's impacting some other things using the db cluster. I found sidewalk-sea sitting on 15 connections just now for no good reason, I restarted the instance to clear the connections. |
This is actually causing an issue when deploying a new version to test today! Got this error when trying to test one of the servers
And it had this same message in the logs:
@mechanicjay this issue is probably getting worse the more servers we add, huh... |
This has happened on a bunch of test servers after our most recent deploy (see #3325). Going to try to push to develop and see if this gets resolved during a deploy to prod. Otherwise I'll email support to get the test servers back up today. Either way, looks like fixing this is becoming a higher priority! |
Here's the exact error message from the Auckland server logs:
|
In thinking through this further, is it possible that the ~4-5 idle connections that begin on startup are related to the database connection pool? This is essentially how a thread pool works—you initialize a thread pool with the size of the pool, which is then a shared resources for the life of the app—but not sure if that analogy works here for databases. |
@mechanicjay opened up another 100 connections for us, bringing us to a max of 200 :) @dylanbun also just updated the code that queries the The last thing I'd like to do is to update the configuration of our database connection pooler, with the configs described here. Current defaults are determined by the
The goal for |
Are we sure that dropping All the other shifts from defaults seem good to me. |
Honestly, not 100% sure. It would mean that we would get hit with the overhead of connecting to the database if no new queries are run in that city during those 30 seconds. How long is the overhead? Really hard to say. This stackoverflow post seems to guess at 67-100 ms, though I think that ours is faster than that having looked through their post. And not all delays mean a delay for the end user. If someone is using the Explore page, they're going to hit the database more than every 30 seconds. On Validate it might be more on the edge for some users. Maybe let's bring it up to 1-2 minutes? Maybe 90 seconds? With the retry delay and such, I kind of want to have ALSO I just found the |
Brief description of problem/feature
When I try to connect to our prod databases via the command line, I'm getting the following error:
This had happened about a year ago as well to a worse degree, where we were getting proxy errors on our servers. It's possible that this has been happening occasionally since then though.
Unfortunately, I did not provide enough detail in my email thread with @mechanicjay... I even say that I thought I figured out the offending code, but I didn't say where that was, and I don't see any commits in the that timeframe that would have addressed it 🥴 What we did conclude is that our application is creating too many database connections for some reason.
From me in the thread:
And later on this is me quoting @mechanicjay and responding:
Potential solution(s)
We'll want to test our application on our local dev env, looking at how many connections are being opened. Then we should try doing different operations to figure out what might be causing the spike in database connections. I think I remember it being queries for Validate and/or Gallery that were the culprit.
The text was updated successfully, but these errors were encountered: