Allow setting the number of workers to be used.
Environments with large numbers of CPUs will create a large
number of workers which can have an unnecessarily large
impact on memory usage, particular where you know how many
workers are needed.
Change-Id: Ie4bb075310a61a0873c9e56e4974600dbb4794a1
diff --git a/lib/cinder b/lib/cinder
index ce13b86..1e7f9c4 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -307,6 +307,9 @@
iniset $CINDER_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
iniset $CINDER_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
+ if [ -n "$API_WORKERS" ]; then
+ iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
+ fi
}
# create_cinder_accounts() - Set up common required cinder accounts
diff --git a/lib/glance b/lib/glance
index 7a28b68..47dd38d 100644
--- a/lib/glance
+++ b/lib/glance
@@ -131,6 +131,10 @@
# sections.
iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
+ if [ -n "$API_WORKERS" ]; then
+ iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
+ fi
+
# Store the images in swift if enabled.
if is_service_enabled s-proxy; then
iniset $GLANCE_API_CONF DEFAULT default_store swift
diff --git a/lib/nova b/lib/nova
index b3a586c..367b916 100644
--- a/lib/nova
+++ b/lib/nova
@@ -516,6 +516,12 @@
iniset $NOVA_CONF DEFAULT ec2_dmz_host "$EC2_DMZ_HOST"
iniset_rpc_backend nova $NOVA_CONF DEFAULT
iniset $NOVA_CONF glance api_servers "$GLANCE_HOSTPORT"
+
+ if [ -n "$API_WORKERS" ]; then
+ iniset $NOVA_CONF DEFAULT osci_compute_workers "$API_WORKERS"
+ iniset $NOVA_CONF DEFAULT ec2_workers "$API_WORKERS"
+ iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
+ fi
}
function init_nova_cells {
diff --git a/stackrc b/stackrc
index e071132..b786288 100644
--- a/stackrc
+++ b/stackrc
@@ -505,6 +505,11 @@
# Allow the use of an alternate protocol (such as https) for service endpoints
SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
+# Sets the maximum number of workers for various services and can restrict
+# the memory used where there are a large number of CPUs present
+# (the default number of workers for many services is the number of CPUs)
+# API_WORKERS=4
+
# Local variables:
# mode: shell-script
# End: