Cap the number of worker threads

Users can configure the number of worker threads however when it's
not specified the calculated number of workers can get too large on
hosts with a large number of CPUs.

Change-Id: I09433117941dcd543775d5c347cb03912c21475c
This commit is contained in:
Ravi Gummadi 2017-02-23 01:26:46 -05:00
parent 7fdad55c63
commit 24f7d80fba
3 changed files with 11 additions and 4 deletions

View File

@ -125,6 +125,10 @@ horizon_disallow_iframe_embed: True
# horizon_wsgi_processes: 4
# horizon_wsgi_threads: 4
## Cap the maximun number of threads / workers when a user value is unspecified.
horizon_wsgi_threads_max: 16
horizon_wsgi_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, horizon_wsgi_threads_max] | min }}"
## Horizon SSL
horizon_ssl_cert: /etc/ssl/certs/horizon.pem
horizon_ssl_key: /etc/ssl/private/horizon.key

View File

@ -0,0 +1,6 @@
---
features:
- Capping the default value for the variables
``horizon_wsgi_processes`` and ``horizon_wsgi_threads`` to 16 when the
user doesn't configure these variables. Default value is half the number
of vCPUs available on the machine with a capping value of 16.

View File

@ -1,8 +1,5 @@
# {{ ansible_managed }}
{% set _wsgi_threads = ansible_processor_vcpus | default(2) // 2 %}
{% set wsgi_threads = _wsgi_threads if _wsgi_threads > 0 else 1 %}
{% if not horizon_external_ssl | bool %}
<VirtualHost *:80>
ServerName {{ horizon_server_name }}
@ -36,7 +33,7 @@
{% endif %}
WSGIScriptAlias / {{ horizon_lib_wsgi_file }}
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(wsgi_threads) }} threads={{ horizon_wsgi_threads | default(wsgi_threads) }} python-path={{ horizon_bin | dirname }}/lib/python2.7/site-packages
WSGIDaemonProcess horizon user={{ horizon_system_user_name }} group={{ horizon_system_group_name }} processes={{ horizon_wsgi_processes | default(horizon_wsgi_threads) }} threads={{ horizon_wsgi_threads }} python-path={{ horizon_bin | dirname }}/lib/python2.7/site-packages
WSGIProcessGroup horizon
WSGIApplicationGroup horizon