Limit the number of sidekiq queue executions #5508
-
|
Hello, I am kaku In my case, the high-priority queue is stuck because it takes too long to execute and affects the execution of other queues. Then it all got stuck. Is there a way to do this in sidekiq pro or sidekiq enterprise? ↓ I have found the gem Could you please help me? thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Weighted queues would accomplish what you want: ---
:queues:
- [high, 1]
- [default, 1]
:concurrency: 10This configuration means that the next job that is executed has a 50% chance of being from the high queue and a 50% chance of being from the default queue. You could also make Capsules when Sidekiq 7 comes out. Using your example: Sidekiq.configure_server do |config|
config.capsule("important") do |cap|
cap.concurrency = 5
cap.queues = %w[important]
end
config.capsule("default") do |cap|
cap.concurrency = 5
cap.queues = %w[default]
end
endThis would have an advantage over weighted queues - the concurrency of each queue is limited to 5. With weighted queues, it is random, so you could end up 10 workers executing from one queue by random chance. |
Beta Was this translation helpful? Give feedback.
Weighted queues would accomplish what you want:
This configuration means that the next job that is executed has a 50% chance of being from the high queue and a 50% chance of being from the default queue.
You could also make Capsules when Sidekiq 7 comes out. Using your example:
This would have an advantage over weighted queues - the concurrency of each queue is limited to 5. With weighted queues,…