Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sidekiq queue weight limit

Tags:

ruby

sidekiq

Is there a limit on queues weight? It's not very clear in the documentation.

From what I understand, the often queue will be checked 2 times more than the default queue and 4 times more than the seldom queue? What if I will add a queue with the the weight of 100?

:queues:
 - [often, 7]
 - [default, 5]
 - [seldom, 3]
like image 817
John Avatar asked Dec 15 '22 02:12

John


1 Answers

The queue weight doesn't follow y = 2x as you suggest. The weight just indicates the chance the next job will be pulled from that queue. Take the following for example:

:queues:
 - [double, 12]
 - [single, 6]
 - [half, 3]

In this, the next job has a 57% chance of coming from double, a 29% chance of coming from single, and a 14% chance of coming from half. If you added a queue with a weight of 100 to this setup, it would skew such that there's an 82% of the next job coming from your new 100-weight queue, 10% from double, 5% from single, and about 2.5% from half.

It's worth noting that this does not control how often a job is actually run or performed, but which queue is checked. For example, configuring an "urgent" queue that has infrequent jobs that need to be run ASAP with a high queue weight will mean your workers are doing more polling relative to the work than with the default configuration.

If you have a situation where you don't want low-priority, long-running jobs to interfere with high-priority, quick jobs, you should consider running a dedicated instance for each instead of attempting to tune the queue weights.

like image 83
coreyward Avatar answered Dec 28 '22 07:12

coreyward