diff --git a/code/processes/converting-process/src/main/java/nu/marginalia/converting/ConverterMain.java b/code/processes/converting-process/src/main/java/nu/marginalia/converting/ConverterMain.java index f9f108f2..5e87f688 100644 --- a/code/processes/converting-process/src/main/java/nu/marginalia/converting/ConverterMain.java +++ b/code/processes/converting-process/src/main/java/nu/marginalia/converting/ConverterMain.java @@ -120,10 +120,11 @@ public class ConverterMain extends ProcessMainClass { public void convert(CrawlPlan plan) throws Exception { - final int maxPoolSize = - Integer.getInteger("converter.poolSize", - Math.clamp(Runtime.getRuntime().availableProcessors() - 2, 1, 32) - ); + final int defaultPoolSize = Boolean.getBoolean("system.conserveMemory") + ? Math.clamp(Runtime.getRuntime().availableProcessors() / 2, 1, 4) // <-- conserve memory + : Math.clamp(Runtime.getRuntime().availableProcessors() - 2, 1, 32); // <-- a more liberal pool size + + final int maxPoolSize = Integer.getInteger("converter.poolSize", defaultPoolSize); try (BatchingWorkLog batchingWorkLog = new BatchingWorkLogImpl(plan.process.getLogFile()); ConverterWriter converterWriter = new ConverterWriter(batchingWorkLog, plan.process.getDir()))