diff --git a/config/puma.rb b/config/puma.rb index 06220b8e5..1e5638a67 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -32,7 +32,9 @@ # Workers do not work on JRuby or Windows (both of which do not support # processes). # -worker_count = (Concurrent.processor_count * 0.666).ceil +# Count the CPUs this container may use: its CPU quota when it has one (ONCE's +# CPU limit, `docker run --cpus`), otherwise every CPU it can see. +worker_count = (Concurrent.available_processor_count * 0.666).ceil workers ENV.fetch("WEB_CONCURRENCY") { worker_count } ENV["JOB_CONCURRENCY"] ||= worker_count.to_s diff --git a/config/resque-pool.yml b/config/resque-pool.yml index 64f569bde..3b782064e 100644 --- a/config/resque-pool.yml +++ b/config/resque-pool.yml @@ -1 +1 @@ -default: <%= (Concurrent.processor_count * 0.5).ceil %> +default: <%= (Concurrent.available_processor_count * 0.5).ceil %>