summaryrefslogtreecommitdiffstats
path: root/configserver/src
diff options
context:
space:
mode:
authorHarald Musum <musum@yahoo-inc.com>2017-06-07 19:55:38 +0200
committerHarald Musum <musum@yahoo-inc.com>2017-06-07 19:55:38 +0200
commitc7f8cb11ea781d59145f4699e06ce8611ad1ec56 (patch)
tree8786622e7576adf9133559087a1ed3e9116aefa9 /configserver/src
parent77450cb1ea8c76990e181a2994ed6eee746db619 (diff)
Deploy using a fixed size thread pool
Diffstat (limited to 'configserver/src')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java21
1 files changed, 5 insertions, 16 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index 76d37f44fbf..229f24152c3 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -71,6 +71,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
private final HttpProxy httpProxy;
private final Clock clock;
private final DeployLogger logger = new SilentDeployLogger();
+ private final ConfigserverConfig configserverConfig;
private final Environment environment;
@Inject
@@ -88,6 +89,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
this.convergeChecker = applicationConvergenceChecker;
this.httpProxy = httpProxy;
this.clock = Clock.systemUTC();
+ this.configserverConfig = configserverConfig;
this.environment = Environment.from(configserverConfig.environment());
}
@@ -333,22 +335,9 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
}
void redeployAllApplications(Deployer deployer) {
- ExecutorService deploymentExecutor = Executors.newCachedThreadPool();
- Set<ApplicationId> applicationIds = new HashSet<>();
-
- tenants.getAllTenants().forEach(tenant -> applicationIds.addAll(tenant.getApplicationRepo().listApplications()));
-
- int applicationsRedeployed = 0;
- for (ApplicationId applicationId : applicationIds) {
- redeployApplication(applicationId, deployer, deploymentExecutor);
- log.log(LogLevel.INFO, String.format("Redeployed %s of %s applications", ++applicationsRedeployed, applicationIds.size()));
- // Throttle deployments
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- throw new RuntimeException("Failed to deploy application " + applicationId, e);
- }
- }
+ ExecutorService deploymentExecutor = Executors.newFixedThreadPool(configserverConfig.numParallelTenantLoaders());
+ tenants.getAllTenants().forEach(tenant -> listApplicationIds(tenant)
+ .forEach(applicationId -> redeployApplication(applicationId, deployer, deploymentExecutor)));
}
private void redeployApplication(ApplicationId applicationId, Deployer deployer, ExecutorService deploymentExecutor) {