This commit is contained in:
redkale
2024-01-23 23:42:37 +08:00
parent 07e9ad4a21
commit ddfdf68c83
3 changed files with 5 additions and 3 deletions

View File

@@ -19,7 +19,8 @@
<!--
【节点全局唯一】 @since 2.3.0
全局Serivce执行的线程池 Application.workExecutor, 没配置该节点将自动创建一个。
threads 线程数为0表示不启用workExecutor只用IO线程。默认: CPU核数, 核数=1的情况下默认值为2
threads 线程数,默认值: CPU核数*10, 核数=2的情况下默认值为20。值为0表示不启用workExecutor都在IO线程中运行
clients client回调函数运行的线程池大小 默认值: CPU核数*4
-->
<executor threads="4"/>

View File

@@ -30,7 +30,8 @@
<!--
【节点全局唯一】 @since 2.3.0
全局Serivce执行的线程池 Application.workExecutor, 没配置该节点将自动创建一个。
threads 线程数为0表示不启用workExecutor只用IO线程。默认: CPU核数, 核数=1的情况下默认值为2
threads 线程数,默认值: CPU核数*10, 核数=2的情况下默认值为20。值为0表示不启用workExecutor都在IO线程中运行
clients client回调函数运行的线程池大小 默认值: CPU核数*4
-->
<executor threads="4"/>

View File

@@ -539,7 +539,7 @@ public final class Application {
final AnyValue executorConf = config.getAnyValue("executor", true);
StringBuilder executorLog = new StringBuilder();
final int workThreads = Math.max(Utility.cpus(), executorConf.getIntValue("threads", Utility.cpus() * 4));
final int workThreads = Math.max(Utility.cpus(), executorConf.getIntValue("threads", Utility.cpus() * 10));
//指定threads则不使用虚拟线程池
this.workExecutor = executorConf.getValue("threads") != null
? WorkThread.createExecutor(workThreads, "Redkale-WorkThread-%s")