diff options
author | Harald Musum <musum@oath.com> | 2018-07-17 10:58:21 +0200 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2018-07-17 10:58:21 +0200 |
commit | 5ca15d375f2e0efa8446423588c917650e5b70a8 (patch) | |
tree | 45490835ad7decae1ce7b9e8fcbe23b108f5760e /node-repository | |
parent | c8493fb4baf19a66ae2ac7bc50e81044f62652d1 (diff) |
Use a thread pool with 1 thread instead of throttling
Diffstat (limited to 'node-repository')
4 files changed, 4 insertions, 16 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ApplicationMaintainer.java index 4240d2bd158..abee3b6ef7f 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ApplicationMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ApplicationMaintainer.java @@ -27,8 +27,10 @@ public abstract class ApplicationMaintainer extends Maintainer { private final Deployer deployer; - // Use a fixed thread pool to avoid overload on config servers - private final Executor deploymentExecutor = Executors.newFixedThreadPool(4, new DaemonThreadFactory("node repo application maintainer")); + // Use a fixed thread pool to avoid overload on config servers. Resource usage when deploying varies + // a lot between applications, so doing one by one avoids issues where one or more resource-demanding + // deployments happen simultaneously + private final Executor deploymentExecutor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("node repo application maintainer")); protected ApplicationMaintainer(Deployer deployer, NodeRepository nodeRepository, Duration interval, JobControl jobControl) { super(nodeRepository, interval, jobControl); @@ -41,7 +43,6 @@ public abstract class ApplicationMaintainer extends Maintainer { for (ApplicationId application : applications) { if (canDeployNow(application)) deploy(application); - throttle(applications.size()); } } @@ -61,8 +62,6 @@ public abstract class ApplicationMaintainer extends Maintainer { protected Deployer deployer() { return deployer; } - /** Block in this method until the next application should be maintained */ - protected abstract void throttle(int applicationCount); private Set<ApplicationId> applicationsNeedingMaintenance() { return nodesNeedingMaintenance().stream() diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java index 57dee7b0dbc..45db9ea90d9 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java @@ -53,9 +53,6 @@ public class OperatorChangeApplicationMaintainer extends ApplicationMaintainer { .anyMatch(event -> event.agent() == Agent.operator && event.at().isAfter(instant)); } - @Override - protected void throttle(int applicationCount) { } - /** * Deploy in the maintenance thread to avoid scheduling multiple deployments of the same application if it takes * longer to deploy than the (short) maintenance interval of this diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java index c0e2d94ebea..e682f2dc76c 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java @@ -26,12 +26,6 @@ public class PeriodicApplicationMaintainer extends ApplicationMaintainer { } @Override - protected void throttle(int applicationCount) { - // Sleep for a length of time that will spread deployment evenly over the maintenance period - try { Thread.sleep(interval().toMillis() / applicationCount); } catch (InterruptedException e) { return; } - } - - @Override protected boolean canDeployNow(ApplicationId application) { Optional<Instant> lastDeploy = deployer().lastDeployTime(application); if (lastDeploy.isPresent() && diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java index 360e8de8d11..edbb965772e 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java @@ -251,8 +251,6 @@ public class PeriodicApplicationMaintainerTest { deployWithLock(application); } - protected void throttle(int applicationCount) { } - @Override protected List<Node> nodesNeedingMaintenance() { if (overriddenNodesNeedingMaintenance.isPresent()) |