No matter what I try, I can't seem to get Sidekiq to honour my max pool size settings. I've tried:
production:
adapter: mysql2
encoding: utf8
database: database
username: username
password: password
host: host
reconnect: true
pool: 10
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:
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.