gem "sidekiq", "7.0.0.beta1"
Then bundle install
.
- Ruby 2.7+
- Rails 6.0+ supported
-
RedisClient
>= 0.9.0
(needs Redis 6.0+) - Rack
>= 2.2.4
- Connection Pool
>= 2.3.0
- ConcurrentRuby
< 2
Docs
https://github.com/sidekiq/sidekiq/pull/5487
Sidekiq.configure_server do |config|
config.queues = %w[
within_30_seconds
within_5_minutes
within_1_hour
within_24_hours
]
config.concurrency = 5
# Define a new capsule which processes jobs from the `unsafe` queue one at a time
config.capsule("capsule/within_24_hours") do |cap|
cap.concurrency = 1
cap.queues = %w[within_24_hours]
end
end
Official doc: https://github.com/sidekiq/sidekiq/wiki/Metrics
https://github.com/sidekiq/sidekiq/wiki/Embedding
Embed Sidekiq in Ruby Process (e.g. Your App server, Puma).
# config/puma.rb
workers 2
threads 5, 5
# Preloading the application is necessary to ensure configs from
# initializers run before the on_worker_boot callback below.
preload_app!
embedded_sidekiq = nil
on_worker_boot do
embedded_sidekiq = Sidekiq.configure_embed do |config|
config.queues = %w[critical default low]
config.concurrency = 2
end
embedded_sidekiq.run
end
on_worker_shutdown do
embedded_sidekiq&.stop
end
https://github.com/sidekiq/sidekiq/blob/7-0/docs/7.0-Upgrade.md