-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Postgresql Heroku keeps connection #3534
Comments
Seems normal to me. Sidekiq doesn't do anything with the database, AR controls those connections. You are seeing 10 more connections created, one for each sidekiq worker thread. |
I see, I am actually trying to understand how all of this works. For the sake of documenting below there is my findings and a command to check active connections and where they came from:
Some curious stuff that I found:
As I mentioned I have 2 puma workers with 1 thread each.
This above should be what I am expecting, 2 connections; But, after deploy and several page loads I end up with as many as (pool - 1) duplicated workers with the same name.
What I did: I set a cron job to destroy connections not used for 5 minutes. If I have time I will get to the bottom of this puma worker situation. |
@dritir Rails has a setting for closing db connections in # set to close unused db connections every 5 mins in database.yml
reaping_frequency: 300 |
Ruby version: 2.4.0
Sidekiq
Hello,
I am running sidekiq with the following setting:
concurrency: 10
,puma: 2 workers/single-threaded
Heroku Redis allows for 20 connections, but it stays at 14 as expected.
I wrote a test job to figure limits for Postgresql pool size:
When testing without querying pg my pg connections stays at around 4. (heroku pg:info)
When I set ar to true, the connections go up, to around 14, the thing is the connection hangs forever, I waited several minutes and it still maintain the 14 connections open.
Shouldn't sidekiq check-out the connection when the job is over?
Thanks
The text was updated successfully, but these errors were encountered: