diff options
author | Harald Musum <musum@verizonmedia.com> | 2019-02-11 11:04:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-11 11:04:38 +0100 |
commit | 0247ccd083972cd433618002db6a0d23f13fb4e1 (patch) | |
tree | ce52f94e5f63c3077911cbf5b00082a1999de7f9 | |
parent | 7391ed47a0482c51c057f722be86c9af04aa1ea1 (diff) | |
parent | 880cf20b1955174ce415f2f0628dbf0a2e90b371 (diff) |
Merge pull request #8445 from vespa-engine/hmusum/minimum-number-of-threads-in-thread-pool
Make sure we have anough threads no matter how many processors the JV…
3 files changed, 6 insertions, 4 deletions
diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UrlDownloadRpcServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UrlDownloadRpcServer.java index f9469b1ae65..3c24cb58cff 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UrlDownloadRpcServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UrlDownloadRpcServer.java @@ -44,7 +44,7 @@ public class UrlDownloadRpcServer { private static final String LAST_MODFIED_FILE_NAME = "lastmodified"; private final File downloadBaseDir; - private final ExecutorService rpcDownloadExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), + private final ExecutorService rpcDownloadExecutor = Executors.newFixedThreadPool(Math.max(8, Runtime.getRuntime().availableProcessors()), new DaemonThreadFactory("Rpc download executor")); UrlDownloadRpcServer(Supervisor supervisor) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java index 16aaef048b5..3034c7dfd53 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/filedistribution/FileServer.java @@ -85,8 +85,8 @@ public class FileServer { private FileServer(ConnectionPool connectionPool, File rootDir) { this.downloader = new FileDownloader(connectionPool); this.root = new FileDirectory(rootDir); - this.pushExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); - this.pullExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); + this.pushExecutor = Executors.newFixedThreadPool(Math.max(8, Runtime.getRuntime().availableProcessors())); + this.pullExecutor = Executors.newFixedThreadPool(Math.max(8, Runtime.getRuntime().availableProcessors())); } boolean hasFile(String fileReference) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java index 1ce90fad465..e8abecc3236 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java @@ -126,7 +126,9 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { this.metrics = metrics.getOrCreateMetricUpdater(Collections.emptyMap()); this.hostLivenessTracker = hostLivenessTracker; BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(config.maxgetconfigclients()); - int numberOfRpcThreads = (config.numRpcThreads() == 0) ? Runtime.getRuntime().availableProcessors() : config.numRpcThreads(); + int numberOfRpcThreads = (config.numRpcThreads() == 0) + ? Math.max(8, Runtime.getRuntime().availableProcessors()) + : config.numRpcThreads(); executorService = new ThreadPoolExecutor(numberOfRpcThreads, numberOfRpcThreads, 0, TimeUnit.SECONDS, workQueue, ThreadFactoryFactory.getThreadFactory(THREADPOOL_NAME)); delayedConfigResponses = new DelayedConfigResponses(this, config.numDelayedResponseThreads()); |