Using Sidekiq’s Redis Connections in Other Places
At Shareaholic we make heavy use of Sidekiq for
background and asynchronous jobs. Because it uses threads it consumes far fewer
resources than its most similar sibling, Resque,
which uses a separate process for each job. We are able to run one Sidekiq
process with 28 threads for each core on our worker machines. Sidekiq wraps all
of its connections in a connection pool using the
connection_pool
gem as can be
seen here.
Sidekiq gives the user access to its connections to redis with the
Sidekiq.redis
method, to which you pass a block and are yielded a connection:
1 2 3 4 |
|