Fix default RPC worker count
The help for the rpc_workers config option is: Number of RPC worker processes for service. If not specified, the default is equal to half the number of API workers. However, this does not accurately describe the current behaviour, which is to default to half the _default_ number of API workers. This can make a big difference; for example on a 256-CPU machine with 256GB of RAM which has api_workers configured to 8 but rpc_workers not configured to anything, this will result in 64 RPC workers, which is 8 for every API worker! Therefore tweak the default to rely on the actual value of api_workers, which may be different than the default value. Change-Id: I26115932ef4775f157297be1637ee26a4fca4666 Related-Bug: #1838688 Closes-Bug: #1838689
This commit is contained in:
parent
04b96b198e
commit
61d149c012
|
@ -176,7 +176,7 @@ def _get_rpc_workers(plugin=None):
|
|||
workers = cfg.CONF.rpc_workers
|
||||
if workers is None:
|
||||
# By default, half as many rpc workers as api workers
|
||||
workers = int(_get_worker_count() / 2)
|
||||
workers = int(_get_api_workers() / 2)
|
||||
if workers < 1:
|
||||
workers = 1
|
||||
|
||||
|
|
|
@ -61,9 +61,13 @@ class TestRunRpcWorkers(base.BaseTestCase):
|
|||
def test_rpc_workers_zero(self):
|
||||
self._test_rpc_workers(0, 1)
|
||||
|
||||
def test_rpc_workers_default(self):
|
||||
def test_rpc_workers_default_api_workers_default(self):
|
||||
self._test_rpc_workers(None, int(self.worker_count / 2))
|
||||
|
||||
def test_rpc_workers_default_api_workers_set(self):
|
||||
cfg.CONF.set_override('api_workers', 18)
|
||||
self._test_rpc_workers(None, 9)
|
||||
|
||||
def test_rpc_workers_defined(self):
|
||||
self._test_rpc_workers(42, 42)
|
||||
|
||||
|
|
Loading…
Reference in New Issue