From 97fb08f0ced20a4b9563725ed9e9600e5ea5722b Mon Sep 17 00:00:00 2001 From: wenjun <861923274@qq.com> Date: Fri, 2 Apr 2021 14:24:37 +0800 Subject: [PATCH] [Improvement][LogServer] Thread pool parameter adjustment #5161 (#5163) * [Improvement][LogServer] Thread pool parameter adjustment #5161 * change log request processor thread num 2 * cpuCores + 1 --- .../dolphinscheduler/server/log/LoggerRequestProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java index c60a4479c1..c9350bf8fb 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java @@ -31,6 +31,7 @@ import org.apache.dolphinscheduler.remote.command.log.RollViewLogResponseCommand import org.apache.dolphinscheduler.remote.command.log.ViewLogRequestCommand; import org.apache.dolphinscheduler.remote.command.log.ViewLogResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; +import org.apache.dolphinscheduler.remote.utils.Constants; import java.io.ByteArrayOutputStream; import java.io.File; @@ -42,6 +43,7 @@ import java.nio.file.Paths; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -60,10 +62,10 @@ public class LoggerRequestProcessor implements NettyRequestProcessor { private final Logger logger = LoggerFactory.getLogger(LoggerRequestProcessor.class); - private final ThreadPoolExecutor executor; + private final ExecutorService executor; public LoggerRequestProcessor() { - this.executor = new ThreadPoolExecutor(4, 4, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100)); + this.executor = Executors.newFixedThreadPool(Constants.CPUS * 2 + 1); } @Override