Skip to content

Commit

Permalink
Verify connection pool sizing, fixes #3917
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Aug 7, 2018
1 parent 03e63b8 commit b1bdaa7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ HEAD
-----------

- **Decrease default concurrency from 25 to 10** [#3892]
- Verify connection pool sizing upon startup [#3917]
- Smoother scheduling for large Sidekiq clusters [#3889]
- Switch Sidekiq::Testing impl from alias\_method to Module#prepend, for resiliency [#3852]
- Update Sidekiq APIs to use SCAN for scalability [#3848, ffiller]
Expand Down
6 changes: 6 additions & 0 deletions lib/sidekiq/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def run
ver = Sidekiq.redis_info['redis_version']
raise "You are using Redis v#{ver}, Sidekiq requires Redis v2.8.0 or greater" if ver < '2.8'

# Since the user can pass us a connection pool explicitly in the initializer, we
# need to verify the size is large enough or else Sidekiq's performance is dramatically slowed.
cursize = Sidekiq.redis_pool.size
needed = Sidekiq.options[:concurrency] + 2
raise "Your pool of #{cursize} Redis connections is too small, please increase the size to at least #{needed}" if cursize < needed

# cache process identity
Sidekiq.options[:identity] = identity

Expand Down
2 changes: 1 addition & 1 deletion sidekiq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = ">= 2.2.2"

gem.add_dependency 'redis', '>= 3.3.5', '< 5'
gem.add_dependency 'connection_pool', '~> 2.2', '>= 2.2.0'
gem.add_dependency 'connection_pool', '~> 2.2', '>= 2.2.2'
gem.add_dependency 'rack-protection', '>= 1.5.0'
end

0 comments on commit b1bdaa7

Please sign in to comment.