Skip to content

Commit

Permalink
Use worker count equal to processor count in production (#46838)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Dec 28, 2022
1 parent afbde03 commit 839ac1e
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -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"
Expand Down

0 comments on commit 839ac1e

Please sign in to comment.