How can I specify different concurrency queues for sidekiq configuration?

落花浮王杯 提交于 2021-02-11 15:23:27

问题


I have the following sidekiq.yml config file, but I'm not sure how to build a separate queue with lower concurrency. How can I do this?

---
:concurrency: 25
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:queues:
  - default
  - [high_priority, 2]
  - [import_queue, 3]
  - [user_queue, 4]
:daemon: true

I would like to do something like the following though,

---
:concurrency: 25
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:queues:
  - default
  - [high_priority, 2]
  - [import_queue, 3]
  - [user_queue, 4]
:daemon: true
---
:concurrency: 5
:pidfile: ./tmp/pids/sidekiq.pid
:logfile: ./log/sidekiq.log
:queues:
  - small_queue
:daemon: true

回答1:


Concurrency is a property of the Sidekiq process, representing how many threads it spins up. You can't have one Sidekiq process operating at two different concurrencies; however, you could spin up two Sidekiq processes with separate config files:

bin/sidekiq -C config/sidekiq_one.yml
bin/sidekiq -C config/sidekiq_two.yml

However, depending on your motivations here, you're likely better off just using one Sidekiq process and ordering your queues within it by priority. That way, no workers in one process are sitting idle while the other process's queue is growing. Though depending on your situation, e.g. if the second queue's jobs are few but very important, such a solution does make sense.



来源:https://stackoverflow.com/questions/34267318/how-can-i-specify-different-concurrency-queues-for-sidekiq-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!