Revert "Set default of api_workers to number of CPUs"
This reverts commit c65175811b
.
This is in relation to:
https://bugs.launchpad.net/neutron/+bug/1432065
Change-Id: I97562840ff57f43958c1e3e56aa41219bd01c8c5
This commit is contained in:
parent
f4e08b1381
commit
12a564cf03
@ -201,12 +201,10 @@ lock_path = $state_path/lock
|
|||||||
# =========== end of items for l3 extension =======
|
# =========== end of items for l3 extension =======
|
||||||
|
|
||||||
# =========== WSGI parameters related to the API server ==============
|
# =========== WSGI parameters related to the API server ==============
|
||||||
# Number of separate worker processes to spawn. A value of 0 runs the
|
# Number of separate worker processes to spawn. The default, 0, runs the
|
||||||
# worker thread in the current process. Greater than 0 launches that number of
|
# worker thread in the current process. Greater than 0 launches that number of
|
||||||
# child processes as workers. The parent process manages them. If not
|
# child processes as workers. The parent process manages them.
|
||||||
# specified, the default value is equal to the number of CPUs available to
|
# api_workers = 0
|
||||||
# achieve best performance.
|
|
||||||
# api_workers = <number of CPUs>
|
|
||||||
|
|
||||||
# Number of separate RPC worker processes to spawn. The default, 0, runs the
|
# Number of separate RPC worker processes to spawn. The default, 0, runs the
|
||||||
# worker thread in the current process. Greater than 0 launches that number of
|
# worker thread in the current process. Greater than 0 launches that number of
|
||||||
|
@ -18,7 +18,6 @@ import logging as std_logging
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_messaging import server as rpc_server
|
from oslo_messaging import server as rpc_server
|
||||||
@ -41,9 +40,8 @@ service_opts = [
|
|||||||
default=40,
|
default=40,
|
||||||
help=_('Seconds between running periodic tasks')),
|
help=_('Seconds between running periodic tasks')),
|
||||||
cfg.IntOpt('api_workers',
|
cfg.IntOpt('api_workers',
|
||||||
help=_('Number of separate API worker processes for service. '
|
default=0,
|
||||||
'If not specified, the default is equal to the number '
|
help=_('Number of separate API worker processes for service')),
|
||||||
'of CPUs available for best performance.')),
|
|
||||||
cfg.IntOpt('rpc_workers',
|
cfg.IntOpt('rpc_workers',
|
||||||
default=0,
|
default=0,
|
||||||
help=_('Number of RPC worker processes for service')),
|
help=_('Number of RPC worker processes for service')),
|
||||||
@ -167,13 +165,6 @@ def serve_rpc():
|
|||||||
'details.'))
|
'details.'))
|
||||||
|
|
||||||
|
|
||||||
def _get_api_workers():
|
|
||||||
workers = cfg.CONF.api_workers
|
|
||||||
if workers is None:
|
|
||||||
workers = processutils.get_worker_count()
|
|
||||||
return workers
|
|
||||||
|
|
||||||
|
|
||||||
def _run_wsgi(app_name):
|
def _run_wsgi(app_name):
|
||||||
app = config.load_paste_app(app_name)
|
app = config.load_paste_app(app_name)
|
||||||
if not app:
|
if not app:
|
||||||
@ -181,7 +172,7 @@ def _run_wsgi(app_name):
|
|||||||
return
|
return
|
||||||
server = wsgi.Server("Neutron")
|
server = wsgi.Server("Neutron")
|
||||||
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
|
server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
|
||||||
workers=_get_api_workers())
|
workers=cfg.CONF.api_workers)
|
||||||
# Dump all option values here after all options are parsed
|
# Dump all option values here after all options are parsed
|
||||||
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
|
||||||
LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
|
LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
# Copyright 2014 Red Hat, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
from neutron import service
|
|
||||||
from neutron.tests import base
|
|
||||||
|
|
||||||
|
|
||||||
class TestService(base.BaseTestCase):
|
|
||||||
|
|
||||||
def test_api_workers_default(self):
|
|
||||||
self.assertEqual(processutils.get_worker_count(),
|
|
||||||
service._get_api_workers())
|
|
||||||
|
|
||||||
def test_api_workers_from_config(self):
|
|
||||||
cfg.CONF.set_override('api_workers', 1234)
|
|
||||||
self.assertEqual(1234,
|
|
||||||
service._get_api_workers())
|
|
Loading…
Reference in New Issue
Block a user