-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RAILS_MAX_THREADS does not affect client redis pool configuration #5886
Comments
I can try and submit a patch if my understanding is correct and this should be addressed. |
RAILS_MAX_THREADS is used in the Sidekiq processes to configure the default capsule concurrency. In other processes, where it is not clear what it is configuring and how that maps to the Redis pool, Sidekiq does not use it. You'd need to do this: Sidekiq.configure_client do |config|
config.redis = { size: Integer(ENV["RAILS_MAX_THREADS"] || 5) }
end |
I understand. However I still think that defaulting the pool size to |
I'm reading this and trying to make sense of what is meant here: In this statement, is "Sidekiq processes" only referring to "server" processes?
Does "In other processes" mean Rails server processes? If so, this statement strikes me as contradictory, because Sidekiq has migrated towards having a lot of automatic config based on a Rails env var that has a very clearly defined meaning.
|
Yes.
It means the Sidekiq client object inside the Rails server process. |
Since the pool is lazy, there's little reason not to allow more headroom so it's there if necessary. I've raised the max size from 5 to 10, will be in 7.1.1. |
* sidekiq#5886 (comment) updated the internal pool size from 5 to 10. * Prior to Sidekiq 7.0, `concurrency + 5` was used: https://github.com/sidekiq/sidekiq/blame/v6.5.12/lib/sidekiq/redis_connection.rb#L93
* #5886 (comment) updated the internal pool size from 5 to 10. * Prior to Sidekiq 7.0, `concurrency + 5` was used: https://github.com/sidekiq/sidekiq/blame/v6.5.12/lib/sidekiq/redis_connection.rb#L93
Ruby version: 2.7.7
Rails version: 6.1.7.3
Sidekiq / Pro / Enterprise version(s): 7.0.9 / 7.0.10 / 7.0.8
Seems like it's recommended to use
RAILS_MAX_THREADS
to configure concurrency since Sidekiq 7.x. It works quite fine for sidekiq server: everything is set to use the same variable (AR pool, Sidekiq's redis pool, Sidekiq's thread number). However it seems like when Sidekiq is in client mode this variable is ignored for its redis pool configuration and defaults for 5. So if you have more than 5 puma threads Sidekiq client will still use pool of 5 redis connections, which leads to errors. Thanks to the fix in #5702 one could still configure it throughsize
option but that seems redundant in case whenRAILS_MAX_THREADS
is already provided.Can be reproduced like this:
The text was updated successfully, but these errors were encountered: