问题
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