Sidekiq Configuration for SOA / Multiple Environments on Same Server

The Sidekiq configuration file by default located at config/sidekiq.yml. It is only necessary to create the file if you need to set advanced options, such as concurrency pool size, named queues, PID file location, etc.

Here is an example configuration file:

:concurrency: 5
:pidfile: tmp/pids/sidekiq.pid
staging:
 :concurrency: 10
production:
 :concurrency: 50
:queues:
 - default

By default, one Sidekiq process will be started on each app server.

Setting the Location of your Redis server

By default, Redis is located at localhost:6379.

Following is my development environment, SOA + Ruby(2.0) + Rails(4.0) + Unicorn  + Nginx  + SideKiq + MultiTenant

In your config/initializers/sidekiq.rb file,

Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://localhost:6379/0', namespace: "sidekiq_app_name_#{Rails.env}" }
end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://localhost:6379/0', namespace: "sidekiq_app_name_#{Rails.env}" }
end

Usage: The :namespace parameter is recommended if Sidekiq is sharing access to a Redis database.

Finally, start sidekiq from the root directory of your Rails app.

bundle exec sidekiq -e staging -C config/sidekiq.yml

Comments