3
votes

No matter what I try, I can't seem to get Sidekiq to honour my max pool size settings. I've tried:

  • setting pool in my database:
production:
  adapter: mysql2
  encoding: utf8
  database: database
  username: username
  password: password
  host: host
  reconnect: true
  pool: 10
  • hard-coding it in my sidekiq initializer (both with and without the disconnect! and both inside and outside the configure server block):
Sidekiq.configure_server do |config|
  ActiveRecord::Base.connection.disconnect!
  ActiveRecord::Base.configurations['production']['pool'] = 50
  ActiveRecord::Base.establish_connection
end
database_url = ENV['DATABASE_URL']
if(database_url)
  ENV['DATABASE_URL'] = "#{database_url}?pool=25"
  ActiveRecord::Base.establish_connection
end

I have no idea why none of these have worked. Any ideas?

In case it's relevant:

  • rails 3.2.12
  • sidekiq 2.6.4
1
If possible could you raise this on Github repo? (github.com/mperham/sidekiq/issues). I am having the issue but you tried more ways so you know more about this issue. - lulalala
Do you use Capistrano? In your backlog trace, do you see the reference to old releases? This happens to me and I think it may be related. - lulalala
How are you checking Sidekiq max pool limit? Is that DATABASE_URL block code inside a Sidekiq.configure_server do |config| block? Did you try to restart? Are you using Heroku? - Jirico

1 Answers

1
votes

Make sure that you're not manually establishing connections in any of the workers, or in any of the code the workers execute. This will increase the number of connections that each worker checks out from the pool (unnecessarily) and will cause your universe to collapse.