Browse code

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

Bob Ball authored on 2014/08/28 22:50:04
Showing 4 changed files
... ...
@@ -307,6 +307,9 @@ function configure_cinder {
307 307
     iniset $CINDER_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
308 308
     iniset $CINDER_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
309 309
 
310
+    if [ -n "$API_WORKERS" ]; then
311
+        iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
312
+    fi
310 313
 }
311 314
 
312 315
 # create_cinder_accounts() - Set up common required cinder accounts
... ...
@@ -131,6 +131,10 @@ function configure_glance {
131 131
     # sections.
132 132
     iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
133 133
 
134
+    if [ -n "$API_WORKERS" ]; then
135
+        iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
136
+    fi
137
+
134 138
     # Store the images in swift if enabled.
135 139
     if is_service_enabled s-proxy; then
136 140
         iniset $GLANCE_API_CONF DEFAULT default_store swift
... ...
@@ -516,6 +516,12 @@ function create_nova_conf {
516 516
     iniset $NOVA_CONF DEFAULT ec2_dmz_host "$EC2_DMZ_HOST"
517 517
     iniset_rpc_backend nova $NOVA_CONF DEFAULT
518 518
     iniset $NOVA_CONF glance api_servers "$GLANCE_HOSTPORT"
519
+
520
+    if [ -n "$API_WORKERS" ]; then
521
+        iniset $NOVA_CONF DEFAULT osci_compute_workers "$API_WORKERS"
522
+        iniset $NOVA_CONF DEFAULT ec2_workers "$API_WORKERS"
523
+        iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
524
+    fi
519 525
 }
520 526
 
521 527
 function init_nova_cells {
... ...
@@ -505,6 +505,11 @@ UNDO_REQUIREMENTS=${UNDO_REQUIREMENTS:-True}
505 505
 # Allow the use of an alternate protocol (such as https) for service endpoints
506 506
 SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
507 507
 
508
+# Sets the maximum number of workers for various services and can restrict
509
+# the memory used where there are a large number of CPUs present
510
+# (the default number of workers for many services is the number of CPUs)
511
+# API_WORKERS=4
512
+
508 513
 # Local variables:
509 514
 # mode: shell-script
510 515
 # End: