diff --git a/doc/administration/postgresql/pgbouncer.md b/doc/administration/postgresql/pgbouncer.md index 91c689fadeabc573f32fdffea60974870f2ec55b..25c4c940b972446e369ad75d9a047afa93973aec 100644 --- a/doc/administration/postgresql/pgbouncer.md +++ b/doc/administration/postgresql/pgbouncer.md @@ -220,8 +220,8 @@ the database. Each of the listed services below use the following formula to def - `puma` : `max_threads + headroom` (default `14`) - `max_threads` is configured via: `gitlab['puma']['max_threads']` (default: `4`) - `headroom` can be configured via `DB_POOL_HEADROOM` environment variable (default to `10`) -- `sidekiq` : `max_concurrency + 1 + headroom` (default: `61`) - - `max_concurrency` is configured via: `sidekiq['max_concurrency']` (default: `50`) +- `sidekiq` : `max_concurrency + 1 + headroom` (default: `31`) + - `max_concurrency` is configured via: `sidekiq['max_concurrency']` (default: `20`) - `headroom` can be configured via `DB_POOL_HEADROOM` environment variable (default to `10`) - `geo-logcursor`: `1+headroom` (default: `11`) - `headroom` can be configured via `DB_POOL_HEADROOM` environment variable (default to `10`) diff --git a/doc/update/index.md b/doc/update/index.md index 04082bd6423437ed4968ea5dc0c24dafac170b4b..33545c05d89d4860e8c1cbaeb4a112674337ac52 100644 --- a/doc/update/index.md +++ b/doc/update/index.md @@ -481,6 +481,19 @@ and [Helm Chart deployments](https://docs.gitlab.com/charts/). They come with ap [backfill `namespace_id` values on issues table](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91921). This migration might take multiple hours or days to complete on larger GitLab instances. Please make sure the migration has completed successfully before upgrading to 15.7.0. +- The default Sidekiq `max_concurrency` has been changed to 20. This is now + consistent in our documentation and product defaults. + + For example, previously: + - Omnibus GitLab default (`sidekiq['max_concurrency']`): 50 + - From source installation default: 50 + - Helm chart default (`gitlab.sidekiq.concurrency`): 25 + + Reference architectures still use a default of 10 as this is set specifically + for those configurations. + + Sites that have configured `max_concurrency` will not be affected by this change. + [Read more about the Sidekiq concurrency setting](../administration/sidekiq/extra_sidekiq_processes.md#concurrency). ### 15.6.0 diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index 52dc14130fbe96fb04dcefe42d6190d8fab93347..341ebd9019af4a614b017fc213df6123cccb4b9a 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -31,8 +31,9 @@ class CLI CommandError = Class.new(StandardError) def initialize(log_output = $stderr) - # As recommended by https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency - @max_concurrency = 50 + # https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency + # https://ruby.social/@getajobmike/109326475545816363 + @max_concurrency = 20 @min_concurrency = 0 @environment = ENV['RAILS_ENV'] || 'development' @metrics_dir = ENV["prometheus_multiproc_dir"] || File.absolute_path("tmp/prometheus_multiproc_dir/sidekiq") diff --git a/sidekiq_cluster/sidekiq_cluster.rb b/sidekiq_cluster/sidekiq_cluster.rb index c68cbe7c16304ffff1ed91c695fe44a49bad4a24..66fb5603d2b783feef4b77c5a9474761cee07700 100644 --- a/sidekiq_cluster/sidekiq_cluster.rb +++ b/sidekiq_cluster/sidekiq_cluster.rb @@ -34,7 +34,7 @@ module SidekiqCluster # directory - The directory of the Rails application. # # Returns an Array containing the PIDs of the started processes. - def self.start(queues, env: :development, directory: Dir.pwd, max_concurrency: 50, min_concurrency: 0, timeout: DEFAULT_SOFT_TIMEOUT_SECONDS, dryrun: false) + def self.start(queues, env: :development, directory: Dir.pwd, max_concurrency: 20, min_concurrency: 0, timeout: DEFAULT_SOFT_TIMEOUT_SECONDS, dryrun: false) queues.map.with_index do |pair, index| start_sidekiq(pair, env: env, directory: directory, diff --git a/spec/commands/sidekiq_cluster/cli_spec.rb b/spec/commands/sidekiq_cluster/cli_spec.rb index 0b73a62e1e037c5fa578007dfa6be07969ae3620..4618c6681d32f4f389455cc1cea62d1d5d610bee 100644 --- a/spec/commands/sidekiq_cluster/cli_spec.rb +++ b/spec/commands/sidekiq_cluster/cli_spec.rb @@ -13,7 +13,7 @@ let(:cli) { described_class.new('/dev/null') } let(:timeout) { Gitlab::SidekiqCluster::DEFAULT_SOFT_TIMEOUT_SECONDS } let(:default_options) do - { env: 'test', directory: Dir.pwd, max_concurrency: 50, min_concurrency: 0, dryrun: false, timeout: timeout } + { env: 'test', directory: Dir.pwd, max_concurrency: 20, min_concurrency: 0, dryrun: false, timeout: timeout } end let(:sidekiq_exporter_enabled) { false } diff --git a/spec/sidekiq_cluster/sidekiq_cluster_spec.rb b/spec/sidekiq_cluster/sidekiq_cluster_spec.rb index c0a919a4aec8dc25e919eb529c6709b8c06be3c4..822acc3fe0f621c96865fa3a868a1f5d92ce0770 100644 --- a/spec/sidekiq_cluster/sidekiq_cluster_spec.rb +++ b/spec/sidekiq_cluster/sidekiq_cluster_spec.rb @@ -35,7 +35,7 @@ expected_options = { env: :development, directory: an_instance_of(String), - max_concurrency: 50, + max_concurrency: 20, min_concurrency: 0, worker_id: an_instance_of(Integer), timeout: 25,