From 8cb6e63a0e7744f4e39ddde714746943c131e300 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 28 Nov 2017 20:40:55 +0000 Subject: [PATCH] [ML] Increase default limit on ML jobs per node from 10 to 20 (elastic/x-pack-elasticsearch#3141) Following the changes of elastic/x-pack-elasticsearch#2975 the hard limit on the number of ML jobs per node is no longer the only limiting factor. Additionally there is now a limit based on the estimated memory usage of the jobs, and this is expected to provide a more sensible limit that accounts for differing resource requirements per job. As a result, it makes sense to raise the default for the hard limit on the number of jobs, on the assumption that the memory limit will prevent the node becoming overloaded if an attempt is made to run many large jobs. Increasing the hard limit will allow more small jobs to be run than was previously the case by default. Of course, this change to the default will have no effect for customers who have already overridden the default in their config files. Original commit: elastic/x-pack-elasticsearch@9fed1d1237ddd954d7d973d4ea404b79451e9e69 --- docs/en/settings/ml-settings.asciidoc | 5 ++++- .../ml/job/process/autodetect/AutodetectProcessManager.java | 2 +- .../xpack/ml/integration/BasicDistributedJobsIT.java | 4 ++-- .../process/autodetect/AutodetectProcessManagerTests.java | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/en/settings/ml-settings.asciidoc b/docs/en/settings/ml-settings.asciidoc index c0d4378a771..318d1857bdc 100644 --- a/docs/en/settings/ml-settings.asciidoc +++ b/docs/en/settings/ml-settings.asciidoc @@ -38,7 +38,10 @@ IMPORTANT: If you want to use {ml} features in your cluster, you must have default behavior. `xpack.ml.max_open_jobs`:: -The maximum number of jobs that can run on a node. Defaults to `10`. +The maximum number of jobs that can run on a node. Defaults to `20`. +The maximum number of jobs is also constrained by memory usage, so fewer +jobs than specified by this setting will run on a node if the estimated +memory use of the jobs would be higher than allowed. `xpack.ml.max_machine_memory_percent`:: The maximum percentage of the machine's memory that {ml} may use for running diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java index e4867d80a06..53e86bda359 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java @@ -88,7 +88,7 @@ public class AutodetectProcessManager extends AbstractComponent { // TODO: Remove the deprecated setting in 7.0 and move the default value to the replacement setting @Deprecated public static final Setting MAX_RUNNING_JOBS_PER_NODE = - Setting.intSetting("max_running_jobs", 10, 1, 512, Property.NodeScope, Property.Deprecated); + Setting.intSetting("max_running_jobs", 20, 1, 512, Property.NodeScope, Property.Deprecated); public static final Setting MAX_OPEN_JOBS_PER_NODE = Setting.intSetting("xpack.ml.max_open_jobs", MAX_RUNNING_JOBS_PER_NODE, 1, Property.NodeScope); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java index 7f73067cae4..0c6635bf71c 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java @@ -216,7 +216,7 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase { DiscoveryNode node = clusterState.nodes().resolveNode(task.getExecutorNode()); assertThat(node.getAttributes(), hasEntry(MachineLearning.ML_ENABLED_NODE_ATTR, "true")); - assertThat(node.getAttributes(), hasEntry(MachineLearning.MAX_OPEN_JOBS_NODE_ATTR, "10")); + assertThat(node.getAttributes(), hasEntry(MachineLearning.MAX_OPEN_JOBS_NODE_ATTR, "20")); JobTaskStatus jobTaskStatus = (JobTaskStatus) task.getStatus(); assertNotNull(jobTaskStatus); assertEquals(JobState.OPENED, jobTaskStatus.getState()); @@ -402,7 +402,7 @@ public class BasicDistributedJobsIT extends BaseMlIntegTestCase { assertFalse(task.needsReassignment(clusterState.nodes())); DiscoveryNode node = clusterState.nodes().resolveNode(task.getExecutorNode()); assertThat(node.getAttributes(), hasEntry(MachineLearning.ML_ENABLED_NODE_ATTR, "true")); - assertThat(node.getAttributes(), hasEntry(MachineLearning.MAX_OPEN_JOBS_NODE_ATTR, "10")); + assertThat(node.getAttributes(), hasEntry(MachineLearning.MAX_OPEN_JOBS_NODE_ATTR, "20")); JobTaskStatus jobTaskStatus = (JobTaskStatus) task.getStatus(); assertNotNull(jobTaskStatus); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java index 0c24be1310b..a59ec3c159a 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java @@ -126,7 +126,7 @@ public class AutodetectProcessManagerTests extends ESTestCase { public void testMaxOpenJobsSetting_givenDefault() { int maxOpenJobs = AutodetectProcessManager.MAX_OPEN_JOBS_PER_NODE.get(Settings.EMPTY); - assertEquals(10, maxOpenJobs); + assertEquals(20, maxOpenJobs); } public void testMaxOpenJobsSetting_givenNewSettingOnly() {