From ee97fb98bc5e767908dd4132ebf06be03853aa6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Wed, 2 Apr 2014 14:24:08 -0700 Subject: [PATCH] more sensible defaults for single core machines --- .../main/java/io/druid/server/DruidProcessingConfig.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/main/java/io/druid/server/DruidProcessingConfig.java b/server/src/main/java/io/druid/server/DruidProcessingConfig.java index ada4eef609d..af596f2da02 100644 --- a/server/src/main/java/io/druid/server/DruidProcessingConfig.java +++ b/server/src/main/java/io/druid/server/DruidProcessingConfig.java @@ -31,4 +31,12 @@ public abstract class DruidProcessingConfig extends ExecutorServiceConfig { return 1024 * 1024 * 1024; } + + @Override @Config(value = "${base_path}.numThreads") + public int getNumThreads() + { + // default to leaving one core for background tasks + final int processors = Runtime.getRuntime().availableProcessors(); + return processors > 1 ? processors - 1 : processors; + } }