From 4b0da513d06ebffad24490b9b08eb2033ee6a181 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Fri, 26 Jan 2018 10:45:05 -0500 Subject: [PATCH] Allow ability to configure number of processes and 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. This also adds the setting of threads and processes to the UWSGI configuration. Change-Id: I003ab426488966cce46bd6fd297c79ada13c9668 Closes-Bug: #1745631 --- defaults/main.yml | 3 ++- templates/barbican-vassals-api.ini.j2 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f0ce495..e04ecaa 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -104,7 +104,8 @@ barbican_service_user_domain_id: default barbican_service_project_name: service # Apache configuration vars -barbican_wsgi_processes: "{{ ansible_processor_vcpus | default (1) * 2 }}" +barbican_wsgi_processes_max: 16 +barbican_wsgi_processes: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, barbican_wsgi_processes_max] | min }}" barbican_wsgi_threads: 1 barbican_apache_log_level: info barbican_apache_servertokens: "Prod" diff --git a/templates/barbican-vassals-api.ini.j2 b/templates/barbican-vassals-api.ini.j2 index a4f0bee..ea6dacf 100644 --- a/templates/barbican-vassals-api.ini.j2 +++ b/templates/barbican-vassals-api.ini.j2 @@ -1,7 +1,8 @@ [uwsgi] socket = :9311 protocol = http -processes = 1 +processes = {{ barbican_wsgi_processes }} +threads = {{ barbican_wsgi_threads }} lazy = true vacuum = true no-default-app = true