From 02767f6d76ec04a0849032754c6a0c9248ef3cb3 Mon Sep 17 00:00:00 2001
From: Pete Birley <pete@port.direct>
Date: Fri, 9 Mar 2018 00:16:45 +0000
Subject: [PATCH] Reduce the number of workers spawned by services

This PS reduces the number of processes spawned by services, as
with Kubernetes load distribution can be better managed by a larger
number of single threaded pods (up to a certain point) and doing so
also provides both increased avilibility, leading to smoother rolling
updates. In addtion when running single replicas resource consuption
is reduced.

Change-Id: Ifb7494a0804913d843a072e10d26c6ec53c3bd16
---
 cinder/values.yaml                             | 2 +-
 glance/values.yaml                             | 2 ++
 heat/values.yaml                               | 8 ++++----
 keystone/templates/etc/_wsgi-keystone.conf.tpl | 4 ++--
 neutron/values.yaml                            | 3 ++-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/cinder/values.yaml b/cinder/values.yaml
index 65b613bf3b..0b5dd88e06 100644
--- a/cinder/values.yaml
+++ b/cinder/values.yaml
@@ -443,7 +443,7 @@ conf:
       use_stderr: true
       enable_v1_api: false
       volume_name_template: "%s"
-      osapi_volume_workers: 8
+      osapi_volume_workers: 1
       glance_api_version: 2
       os_region_name: RegionOne
       host: cinder-volume-worker
diff --git a/glance/values.yaml b/glance/values.yaml
index 75f195fb3a..8ff5133e76 100644
--- a/glance/values.yaml
+++ b/glance/values.yaml
@@ -218,6 +218,7 @@ conf:
       #NOTE(portdirect): the bind port should not be defined, and is manipulated
       # via the endpoints section.
       bind_port: null
+      workers: 1
     keystone_authtoken:
       auth_type: password
       auth_version: v3
@@ -266,6 +267,7 @@ conf:
       #NOTE(portdirect): the bind port should not be defined, and is manipulated
       # via the endpoints section.
       bind_port: null
+      workers: 1
     keystone_authtoken:
       auth_type: password
       auth_version: v3
diff --git a/heat/values.yaml b/heat/values.yaml
index 765f06fb05..488b67028b 100644
--- a/heat/values.yaml
+++ b/heat/values.yaml
@@ -210,7 +210,7 @@ conf:
     resource_types:OS::Cinder::QoSSpecs: rule:project_admin
   heat:
     DEFAULT:
-      num_engine_workers: 4
+      num_engine_workers: 1
       trusts_delegated_roles: ""
       host: heat-engine
     keystone_authtoken:
@@ -226,17 +226,17 @@ conf:
       #NOTE(portdirect): the bind port should not be defined, and is manipulated
       # via the endpoints section.
       bind_port: null
-      workers: 4
+      workers: 1
     heat_api_cloudwatch:
       #NOTE(portdirect): the bind port should not be defined, and is manipulated
       # via the endpoints section.
       bind_port: null
-      workers: 4
+      workers: 1
     heat_api_cfn:
       #NOTE(portdirect): the bind port should not be defined, and is manipulated
       # via the endpoints section.
       bind_port: null
-      workers: 4
+      workers: 1
     paste_deploy:
       api_paste_config: /etc/heat/api-paste.ini
     clients:
diff --git a/keystone/templates/etc/_wsgi-keystone.conf.tpl b/keystone/templates/etc/_wsgi-keystone.conf.tpl
index 6e126e1ef2..96966e512f 100644
--- a/keystone/templates/etc/_wsgi-keystone.conf.tpl
+++ b/keystone/templates/etc/_wsgi-keystone.conf.tpl
@@ -25,7 +25,7 @@ CustomLog /dev/stdout combined env=!forwarded
 CustomLog /dev/stdout proxy env=forwarded
 
 <VirtualHost *:{{ tuple "identity" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}>
-    WSGIDaemonProcess keystone-public processes=1 threads=4 user=keystone group=keystone display-name=%{GROUP}
+    WSGIDaemonProcess keystone-public processes=1 threads=1 user=keystone group=keystone display-name=%{GROUP}
     WSGIProcessGroup keystone-public
     WSGIScriptAlias / /var/www/cgi-bin/keystone/keystone-wsgi-public
     WSGIApplicationGroup %{GLOBAL}
@@ -41,7 +41,7 @@ CustomLog /dev/stdout proxy env=forwarded
 </VirtualHost>
 
 <VirtualHost *:{{ tuple "identity" "internal" "admin" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}>
-    WSGIDaemonProcess keystone-admin processes=1 threads=4 user=keystone group=keystone display-name=%{GROUP}
+    WSGIDaemonProcess keystone-admin processes=1 threads=1 user=keystone group=keystone display-name=%{GROUP}
     WSGIProcessGroup keystone-admin
     WSGIScriptAlias / /var/www/cgi-bin/keystone/keystone-wsgi-admin
     WSGIApplicationGroup %{GLOBAL}
diff --git a/neutron/values.yaml b/neutron/values.yaml
index fd04fd3341..06567e690b 100644
--- a/neutron/values.yaml
+++ b/neutron/values.yaml
@@ -954,7 +954,8 @@ conf:
       # via the endpoints section.
       bind_port: null
       default_availability_zones: nova
-      api_workers: 4
+      api_workers: 1
+      rpc_workers: 1
       allow_overlapping_ips: True
       # core_plugin can be: ml2, calico
       core_plugin: ml2