Byte Friendly

Random thoughts on programming and related topics.

Queue Prioritization in Sidekiq

| Comments

Unlike Resque, Sidekiq allows you to process several queues at the same time. You can even assign priorities. Here’s an example from default config:

1
2
3
4
:queues:
  - [often, 7]
  - [default, 5]
  - [seldom, 3]

If you want two queues have equal rights, just set the same priorities. However, if you omit priority parameter and define your queues like this:

1
2
3
4
:queues:
  - email
  - coffee
  - billing

Then queues will be checked in a serial manner. That is, Sidekiq will start making coffee only when all emails are sent. If a new email shows up, it will be processed before any other job. In other words, this is how Resque would handle the queues.

Choose whatever fits your task better. It’s nice to have some flexibility.

Comments