diff --git a/etc/trove/trove.conf.sample b/etc/trove/trove.conf.sample index 9fc1529c98..50348a195e 100644 --- a/etc/trove/trove.conf.sample +++ b/etc/trove/trove.conf.sample @@ -11,8 +11,9 @@ bind_host = 0.0.0.0 # Port the bind the API server to bind_port = 8779 -# Number of child processes to run -#trove_api_workers=5 +# Number of workers for the API service. The default will +# be the number of CPUs available. (integer value) +#trove_api_workers=None # The RabbitMQ broker address where a single node is used. # (string value) diff --git a/etc/trove/trove.conf.test b/etc/trove/trove.conf.test index b77a6a4085..3ef007c52e 100644 --- a/etc/trove/trove.conf.test +++ b/etc/trove/trove.conf.test @@ -34,8 +34,9 @@ bind_host = 0.0.0.0 # Port the bind the API server to bind_port = 8779 -# Number of child processes to run -#trove_api_workers=5 +# Number of workers for the API service. The default will +# be the number of CPUs available. (integer value) +#trove_api_workers=None # AMQP Connection info rabbit_password=f7999d1955c5014aa32c diff --git a/trove/cmd/api.py b/trove/cmd/api.py index 55e9ae02f3..89a92624e3 100755 --- a/trove/cmd/api.py +++ b/trove/cmd/api.py @@ -13,12 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. from trove.cmd.common import with_initialize +from trove.openstack.common import processutils @with_initialize def main(CONF): from trove.common import wsgi conf_file = CONF.find_file(CONF.api_paste_config) + workers = CONF.trove_api_workers or processutils.get_worker_count() launcher = wsgi.launch('trove', CONF.bind_port or 8779, conf_file, - workers=CONF.trove_api_workers) + workers=workers) launcher.wait() diff --git a/trove/cmd/conductor.py b/trove/cmd/conductor.py index 0508e51be9..0e8c482814 100755 --- a/trove/cmd/conductor.py +++ b/trove/cmd/conductor.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. from trove.cmd.common import with_initialize +from trove.openstack.common import processutils @with_initialize @@ -23,6 +24,6 @@ def main(conf): topic = conf.conductor_queue server = rpc_service.RpcService(manager=conf.conductor_manager, topic=topic) - launcher = openstack_service.launch(server, - workers=conf.trove_conductor_workers) + workers = conf.trove_conductor_workers or processutils.get_worker_count() + launcher = openstack_service.launch(server, workers=workers) launcher.wait() diff --git a/trove/cmd/fakemode.py b/trove/cmd/fakemode.py index ee83e94a5a..68e012f35e 100755 --- a/trove/cmd/fakemode.py +++ b/trove/cmd/fakemode.py @@ -14,6 +14,7 @@ # under the License. from oslo.config import cfg as openstack_cfg from trove.cmd.common import with_initialize +from trove.openstack.common import processutils opts = [ @@ -57,7 +58,8 @@ def start_fake_taskmanager(conf): def start_server(conf): from trove.common import wsgi conf_file = conf.find_file(conf.api_paste_config) + workers = conf.trove_api_workers or processutils.get_worker_count() launcher = wsgi.launch('trove', conf.bind_port or 8779, conf_file, - workers=conf.trove_api_workers) + workers=workers) start_fake_taskmanager(conf) launcher.wait() diff --git a/trove/common/cfg.py b/trove/common/cfg.py index 314e6c1e98..8bd1f9b54b 100644 --- a/trove/common/cfg.py +++ b/trove/common/cfg.py @@ -119,7 +119,9 @@ common_opts = [ help='Default driver to use for quota checks.'), cfg.StrOpt('taskmanager_queue', default='taskmanager'), cfg.StrOpt('conductor_queue', default='trove-conductor'), - cfg.IntOpt('trove_conductor_workers', default=1), + cfg.IntOpt('trove_conductor_workers', + help="Number of workers for the Conductor service. The default " + "will be the number of CPUs available."), cfg.BoolOpt('use_nova_server_volume', default=False), cfg.BoolOpt('use_heat', default=False), cfg.StrOpt('device_path', default='/dev/vdb'), @@ -151,7 +153,9 @@ common_opts = [ cfg.BoolOpt('trove_security_groups_support', default=True), cfg.StrOpt('trove_security_group_name_prefix', default='SecGroup'), cfg.StrOpt('trove_security_group_rule_cidr', default='0.0.0.0/0'), - cfg.IntOpt('trove_api_workers', default=None), + cfg.IntOpt('trove_api_workers', + help="Number of workers for the API service. The default will " + "be the number of CPUs available."), cfg.IntOpt('usage_sleep_time', default=5, help='Time to sleep during the check active guest.'), cfg.StrOpt('region', default='LOCAL_DEV',