From f116f87c91d9d65f570c98071f6aa9506300f766 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 6 Feb 2017 16:33:49 +0100 Subject: 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 --- config/initializers/sidekiq.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'config/initializers/sidekiq.rb') 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')}") -- cgit v1.2.1