more sensible defaults for single core machines

This commit is contained in:
Xavier Léauté 2014-04-02 14:24:08 -07:00
parent 89dd0ee29c
commit ee97fb98bc
1 changed files with 8 additions and 0 deletions

View File

@ -31,4 +31,12 @@ public abstract class DruidProcessingConfig extends ExecutorServiceConfig
{ {
return 1024 * 1024 * 1024; 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;
}
} }