Use worker count equal to processor count in production (#46838)
This commit is contained in:
parent
afbde03801
commit
839ac1e70f
@ -11,6 +11,12 @@ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
||||
threads min_threads_count, max_threads_count
|
||||
|
||||
# Specifies that the worker count should equal the number of processors in production.
|
||||
if ENV["RAILS_ENV"] == "production"
|
||||
worker_count = ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count }
|
||||
workers worker_count if worker_count > 1
|
||||
end
|
||||
|
||||
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
||||
# terminating a worker in development environments.
|
||||
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
||||
|
Loading…
Reference in New Issue
Block a user