From 05bd7b803d87bbdd1a6f11cfd278eec319c819ea Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 16 Sep 2014 17:25:33 -0500 Subject: [PATCH] Set default API_WORKERS Set the API_WORKERS default to control memory usage. Maximum is nproc / 2 and minimum is 2. * Also updates https://review.openstack.org/#/c/117517/ to remove the conditional test as API_WORKERS should always be set. * Update https://review.openstack.org/#/c/109058/ for ceilometer to use API_WORKERS The following reviews can move forward either as-is or with minor tweaks: * Keystone: https://review.openstack.org/#/c/121384/ - remove the if check * Swift: https://review.openstack.org/#/c/121456/ - unabandon, the default to 1 is fine, or remove it to match the others. * Trove: https://review.openstack.org/#/c/121438/ - remove the if check https://etherpad.openstack.org/p/devstack-workers has the details Change-Id: Id28d72ebf01c88b7df301edf7d1dd7ec23fcd0d6 --- lib/ceilometer | 2 +- lib/cinder | 4 +--- lib/glance | 4 +--- lib/nova | 8 +++----- stackrc | 5 +++-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/ceilometer b/lib/ceilometer index a71643aecb..b9e42a2dec 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -154,7 +154,7 @@ function configure_ceilometer { if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then iniset $CEILOMETER_CONF database connection `database_connection_url ceilometer` - iniset $CEILOMETER_CONF DEFAULT collector_workers $(( ($(nproc) + 1) / 2 )) + iniset $CEILOMETER_CONF DEFAULT collector_workers $API_WORKERS else iniset $CEILOMETER_CONF database connection mongodb://localhost:27017/ceilometer configure_mongodb diff --git a/lib/cinder b/lib/cinder index 5c487a20e0..e767fa8218 100644 --- a/lib/cinder +++ b/lib/cinder @@ -307,9 +307,7 @@ function configure_cinder { 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 + iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS" } # create_cinder_accounts() - Set up common required cinder accounts diff --git a/lib/glance b/lib/glance index d6d12ca10a..054a7afd33 100644 --- a/lib/glance +++ b/lib/glance @@ -138,9 +138,7 @@ function configure_glance { # 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 + iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS" # Store the images in swift if enabled. if is_service_enabled s-proxy; then diff --git a/lib/nova b/lib/nova index 14d07b05bd..4864c0bc6e 100644 --- a/lib/nova +++ b/lib/nova @@ -518,11 +518,9 @@ function create_nova_conf { 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 + 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" } function init_nova_cells { diff --git a/stackrc b/stackrc index 53c857935a..0af9c4c6bd 100644 --- a/stackrc +++ b/stackrc @@ -508,10 +508,11 @@ UNDO_REQUIREMENTS=${UNDO_REQUIREMENTS:-True} # 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 +# Sets the maximum number of workers for most services to reduce # 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 +# Also sets the minimum number of workers to 2. +API_WORKERS=${API_WORKERS:=$(( ($(nproc)/2)<2 ? 2 : ($(nproc)/2) ))} # Local variables: # mode: shell-script