Sidekiq 7 adds a new feature called capsules Show archive.org snapshot .
Use cases:
chrome
queue limited to 1
for e.g. PDF processing to not overload the application serverapi
queue, that limits a queue to 2
to protect the API server from too many requests in parallelExample:
Sidekiq.configure_server do |config|
# Edits the default capsule
config.queues = %w[critical default low]
config.concurrency = 5
# Define a new capsule which processes jobs from the `unsafe` queue one at a time
config.capsule("unsafe") do |cap|
cap.concurrency = 1
cap.queues = %w[unsafe]
end
end
Some notes:
config.concurrency = 5
you also might have this config in a sidekiq.yml
file saying :concurrency: 5
.unsafe
queue is 2. And the total number of threads 12.capsule
are still accessible for all other jobs. In the example above it is possible to run 6 jobs in the critical
queue. The order of the jobs is configured with the priority for each queue.