{%- set passenger_ruby = '/usr/local/rvm/wrappers/default/ruby'
if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') else
'/usr/bin/ruby' %}
-{%- set max_workers = ("__CONTROLLER_MAX_WORKERS__" or grains['num_cpus'])|int %}
-{%- set max_reqs = ("__CONTROLLER_MAX_QUEUED_REQUESTS__" or 1024)|int %}
+{%- set _workers = ("__CONTROLLER_MAX_WORKERS__" or grains['num_cpus']*2)|int %}
+{%- set max_workers = [_workers, 8]|max %}
+{%- set max_reqs = ("__CONTROLLER_MAX_QUEUED_REQUESTS__" or 128)|int %}
### NGINX
nginx:
# Make the passenger queue small (twice the concurrency, so
# there's at most one pending request for each busy worker)
# because controller reorders requests based on priority, and
- # won't send more than API.MaxConcurrentRequests to passenger
+ # won't send more than API.MaxConcurrentRailsRequests to passenger
# (which is max_workers * 2), so things that are moved to the head
# of the line get processed quickly.
passenger_max_request_queue_size: {{ max_workers * 2 + 1 }}