我仍然对随着时间的推移缓慢增长的进程数量存在问题,但到目前为止我想出的限制并发设置的最佳解决方案是更改这两个文件:
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/4_sidekiq.rb
/opt/gitlab/embedded/service/gitlab-ci/config/initializers/3_sidekiq.rb
通过config.options[:concurrency] = 2
在里面添加Sidekiq.configure_server do |config|
因此,例如,我的最终4_sidekiq.rb
文件如下所示:
# Custom Redis configuration
config_file = Rails.root.join('config', 'resque.yml')
resque_url = if File.exists?(config_file)
YAML.load_file(config_file)[Rails.env]
else
"redis://localhost:6379"
end
Sidekiq.configure_server do |config|
config.options[:concurrency] = 2
config.redis = {
url: resque_url,
namespace: 'resque:gitlab'
}
config.server_middleware do |chain|
chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS']
chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS']
end
end
Sidekiq.configure_client do |config|
config.redis = {
url: resque_url,
namespace: 'resque:gitlab'
}
end