Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sidekiq ignoring pool size setting

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
  • setting it using a DATABASE_URL env var (and yes, I made sure DATABASE_URL was set, using https://github.com/glenngillen/rails-database-url):
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
like image 749
lukerandall Avatar asked Jan 20 '26 21:01

lukerandall


1 Answers

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.

like image 183
Gazza Avatar answered Jan 23 '26 04:01

Gazza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!