From ea00eb26f2078a04f904e2337d16973eaf7a8090 Mon Sep 17 00:00:00 2001 From: Ravi Gummadi Date: Wed, 22 Feb 2017 07:16:34 -0500 Subject: [PATCH] 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: If0e1f051ecdc0e1cc9713c7300e72e0748e01737 --- defaults/main.yml | 6 +++--- ...apping_cinder_osapi_volume_workers-db32afcf7615b05b.yaml | 5 +++++ templates/cinder.conf.j2 | 5 +---- 3 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/capping_cinder_osapi_volume_workers-db32afcf7615b05b.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 4b2b22fe..5644f037 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -153,9 +153,9 @@ cinder_service_backup_metadata_version: 2 cinder_swift_catalog_info: "object-store:swift:internalURL" -# If ``cinder_osapi_volume_workers`` is unset the system will use half the number of -# available VCPUS to compute the number of api workers to use. -# cinder_osapi_volume_workers: 16 +## Cap the maximun number of threads / workers when a user value is unspecified. +cinder_osapi_volume_workers_max: 16 +cinder_osapi_volume_workers: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, cinder_osapi_volume_workers_max] | min }}" ## Cinder iscsi cinder_iscsi_helper: tgtadm diff --git a/releasenotes/notes/capping_cinder_osapi_volume_workers-db32afcf7615b05b.yaml b/releasenotes/notes/capping_cinder_osapi_volume_workers-db32afcf7615b05b.yaml new file mode 100644 index 00000000..0f33f8e5 --- /dev/null +++ b/releasenotes/notes/capping_cinder_osapi_volume_workers-db32afcf7615b05b.yaml @@ -0,0 +1,5 @@ +--- +features: + - Capping the default value for the variable ``cinder_osapi_volume_workers`` + to 16 when the user doesn't configure this variable. Default value is half + the number of vCPUs available on the machine with a capping value of 16. diff --git a/templates/cinder.conf.j2 b/templates/cinder.conf.j2 index 5207c045..51521402 100644 --- a/templates/cinder.conf.j2 +++ b/templates/cinder.conf.j2 @@ -1,8 +1,5 @@ # {{ ansible_managed }} -{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %} -{% set api_threads = _api_threads if _api_threads > 0 else 1 %} - [DEFAULT] # Disable stderr logging use_stderr = False @@ -10,7 +7,7 @@ debug = {{ debug }} fatal_deprecations = {{ cinder_fatal_deprecations }} my_ip = {{ cinder_management_address }} -osapi_volume_workers = {{ cinder_osapi_volume_workers | default(api_threads) }} +osapi_volume_workers = {{ cinder_osapi_volume_workers }} rootwrap_config = /etc/cinder/rootwrap.conf api_paste_config = /etc/cinder/api-paste.ini