Use (# of CPUs) api/conductor workers by default

This changes the default number of trove API and conductor workers to be
equal to the number of CPUs available on the host, rather than
defaulting to 1 as it did before.

Commit 75c96a48fc7e5dfb59d8258142b01422f81b0253 did the same thing in
Nova in Icehouse. Similar changes are being made to Glance and Cinder
as well.

DocImpact: trove_api_workeres and trove_conductor_workers will now be
           equal to the number of CPUs available by default if not
           explicitly specified in the trove configuration files.

UpgradeImpact: Anyone upgrading to this change that does not have
           trove_api_workers or trove_conductor_workers specified in
           the trove configuration files will now be running multiple
           API and conductor workers by default when they restart the
           respective trove services.

Closes-Bug: #1335284

Change-Id: Id300bbe991436a0f826ea715630669ab5922a6a4
This commit is contained in:
Matt Riedemann 2014-07-07 10:43:06 -07:00
parent 5c0b202ae3
commit e932c4777d
6 changed files with 21 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -122,7 +122,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'),
@ -154,7 +156,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',