How to manage concurrency in a queue?

Sidekiq documentation assumes that I can manage the global concurrency sidekiq, and not every queue. I raise the question here with the hope that there is a solution for setting concurrency for each queue. Some third-party services simply do not accept high concurrency, and limiting all sidekiq is simply painful for them.

I am on sidekiq 3.3

+4
source share
2 answers

You can try the limit-fetch extension: https://github.com/brainopia/sidekiq-limit_fetch

+3
source

Heroku, concurrency , Procfile sidekiq.rb:

Sidekiq.configure_server do |config|
 config.options[:concurrency] = (ENV['SIDEKIQ_WORKERS_PROCFILE'] || ENV['SIDEKIQ_WORKERS'] || 1).to_i
 ...
end

SIDEKIQ_WORKERS_PROCFILE Procfile - SIDEKIQ_WORKERS, Heroku.

, .

, Heroku, dyno.. - sidekiq concurrency, dynos - , .

Procfile :

web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
default: env HEROKU_PROCESS=default bundle exec sidekiq -c 5
important: env HEROKU_PROCESS=important bundle exec sidekiq -q important -c 5
instant: env HEROKU_PROCESS=instant bundle exec sidekiq -q instant -c 5
matrices: env HEROKU_PROCESS=matrices SIDEKIQ_CONCURRENCY=1 bundle exec sidekiq -q matrices -c 1

, matrices SIDEKIQ_CONCURRENCY, 1 - concurrency. sidekiq.rb. , -c 1 - , .

.

sidekiq , matrices 1 , - 3 ( SIDEKIQ_WORKER ​​ 3 Heroku):

enter image description here

+1

All Articles