0.04
Repository is archived
Low commit activity in last 3 years
There's a lot of open issues
No release in over a year
Allows Sidekiq using more CPU cores on Ruby MRI by forking multiple processes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.0

Runtime

>= 3.0, < 7.0
 Project Readme

⚠️ Not maintained anymore, superseded by einhorn

Sidekiq::Pool

Gem Build Status

Allows Sidekiq using more CPU cores on Ruby MRI by forking multiple processes. Also adds an option to use different command line option workers in the same pool.

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-pool'

Create a config file and specify it's path with the p command line option (the default is config/sidekiq-pool.yml)

Paste the following config and modify it to your needs:

:working_directory: /path/to/working/direcory # optional, needed if HUP reload is used with symlink
:workers:
  -
    :command: '-q default -q high'
    :amount: 2
  -
    :command: '-q high -L high_logfile.txt'
    :amount: 1

Usage

Help

$ bundle exec sidekiq-pool -h

Start pool with a non-default path config

$ bundle exec sidekiq-pool -p config/pool_config.yml

Signals

Signals USR1, USR2, and TSTP are forwarded to the children. Depending on the version of Sidekiq, you may need to send USR1 or TSTP to prepare it for shutdown. For more information, please read signals and sidekiq documentation.

Signal HUP to parent starts new children and then stops old.

When using symlinked working directory working_directory configuration option must be used to pick up new code.

After fork

You may want to execute code after process has been forked. It can be done by registering after_fork hook like this

require 'sidekiq/pool'
Sidekiq::Pool.after_fork do
  # run code here
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/vinted/sidekiq-pool.

License

The gem is available as open source under the terms of the MIT License.