Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Redis pool shared between Sidekiq and Rails application

$
0
0

Currently I use this configuration:

# concurrency = 25

$redis = ConnectionPool.new(size: 30) { Redis.new(url: ENV['REDIS_URL']) }
Sidekiq.configure_server do |config|
  config.redis = $redis
end
Sidekiq.configure_client do |config|
  config.redis = $redis
end

Note that the same $redis pool is also used in my own application code, for example:

$redis.with do |conn|
  # ...
end

Now I wonder if that is correct, or if that may create a bottleneck.

Is it better to use a separate connection pool for Sidekiq and a different one for the application?

E.g.

# use this pool only in my own code
$redis = ConnectionPool.new(size: 30) { Redis.new(url: ENV['REDIS_URL']) }

# and I define a separate connection pool only for Sidekiq
Sidekiq.configure_server do |config|
  config.redis = ConnectionPool.new(size: 30) { Redis.new(url: ENV['REDIS_URL']) }
end
Sidekiq.configure_client do |config|
  config.redis = ConnectionPool.new(size: 30) { Redis.new(url: ENV['REDIS_URL']) }
end

Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>