From 4e0b000e4317c20cebec00f9d972af03b521395a Mon Sep 17 00:00:00 2001 From: Duc Truong Date: Tue, 10 Jul 2018 22:52:30 +0000 Subject: [PATCH] Add scheduler_thread_pool_size configuration Add scheduler_thread_pool_size configuration and set default value to 1000 to match oslo_service default for service threadgroup [1] [1] https://github.com/openstack/oslo.service/blob/master/oslo_service/service.py#L718 Change-Id: Ie971f8321a472ef34396faed81aa676eaa006701 --- .../notes/scheduler-thread-pool-size-40905866197ef8bd.yaml | 6 ++++++ senlin/common/config.py | 3 +++ senlin/engine/scheduler.py | 3 ++- senlin/tests/unit/engine/test_node.py | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/scheduler-thread-pool-size-40905866197ef8bd.yaml diff --git a/releasenotes/notes/scheduler-thread-pool-size-40905866197ef8bd.yaml b/releasenotes/notes/scheduler-thread-pool-size-40905866197ef8bd.yaml new file mode 100644 index 000000000..ef4c3aa4c --- /dev/null +++ b/releasenotes/notes/scheduler-thread-pool-size-40905866197ef8bd.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Added scheduler thread pool size configuration value and changed default + thread pool size for scheduler from 10 to 1000. This fix prevents problems + when a large number of cluster operations are executed simultaneously. diff --git a/senlin/common/config.py b/senlin/common/config.py index d04ae6b8f..d0d88df1f 100755 --- a/senlin/common/config.py +++ b/senlin/common/config.py @@ -107,6 +107,9 @@ engine_opts = [ default=60, help=_('Maximum time since last check-in for a service to be ' 'considered up.')), + cfg.IntOpt('scheduler_thread_pool_size', + default=1000, + help=_('Maximum number of threads to use for scheduler.')), ] cfg.CONF.register_opts(engine_opts) diff --git a/senlin/engine/scheduler.py b/senlin/engine/scheduler.py index 6c5d51639..79a6f6f57 100644 --- a/senlin/engine/scheduler.py +++ b/senlin/engine/scheduler.py @@ -33,7 +33,8 @@ class ThreadGroupManager(object): def __init__(self): super(ThreadGroupManager, self).__init__() - self.group = threadgroup.ThreadGroup() + self.group = threadgroup.ThreadGroup( + thread_pool_size=cfg.CONF.scheduler_thread_pool_size) # Create dummy service task, because when there is nothing queued # on self.tg the process exits diff --git a/senlin/tests/unit/engine/test_node.py b/senlin/tests/unit/engine/test_node.py index 215e64be7..9a12b4bc4 100644 --- a/senlin/tests/unit/engine/test_node.py +++ b/senlin/tests/unit/engine/test_node.py @@ -974,7 +974,7 @@ class TestNode(base.SenlinTestCase): 'FAKE_KEY1': 'FAKE_VALUE1', 'FAKE_KEY2': 'FAKE_VALUE2', } - final_inputs = jsonutils.dumps(final_dict) + final_inputs = jsonutils.dumps(final_dict, sort_keys=False) wfc.execution_create.assert_called_once_with('foo', final_inputs) def test_run_workflow_failed_creation(self):