diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-02-06 18:33:49 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-02-06 18:35:41 +0300 |
commit | f116f87c91d9d65f570c98071f6aa9506300f766 (patch) | |
tree | 033c19234ffac6a3fe9c6bdc238d5c2f5f89d326 /config/initializers | |
parent | 53db7d1d75e1d14cb20278bd0c1a75ce24a6626d (diff) |
Don't use backup AR connections for Sidekiq
Adding two extra connections does nothing other than increasing the
number of idle database connections. Given Sidekiq uses N threads it can
never use more than N AR connections at a time, thus we don't need more.
The initializer mentioned the Sidekiq upgrade guide stating this was
required. This is false, the Sidekiq upgrade guide states this is
necessary for Redis and not ActiveRecord.
On GitLab.com this resulted in a reduction of about 80-100 PostgreSQL
connections.
Fixes #27713
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/sidekiq.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index fa318384405..0c4516b70f0 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -36,11 +36,9 @@ Sidekiq.configure_server do |config| Gitlab::SidekiqThrottler.execute! - # Database pool should be at least `sidekiq_concurrency` + 2 - # For more info, see: https://github.com/mperham/sidekiq/blob/master/4.0-Upgrade.md config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env] - config['pool'] = Sidekiq.options[:concurrency] + 2 + config['pool'] = Sidekiq.options[:concurrency] ActiveRecord::Base.establish_connection(config) Rails.logger.debug("Connection Pool size for Sidekiq Server is now: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}") |