From b19f3681cafd85c59e1d1abc99bc04e8bacce9ea Mon Sep 17 00:00:00 2001 From: "everywhere.z" Date: Fri, 20 Dec 2024 12:13:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0benchmark=E7=9A=84=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liteflow/benchmark/CommonBenchmark.java | 5 +++++ .../com/yomahub/liteflow/benchmark/cmp/DCmp.java | 15 +++++++++++++++ .../src/test/resources/application.properties | 5 ++++- .../ParallelLoopELSpringbootTest.java | 8 ++++++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/cmp/DCmp.java diff --git a/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/CommonBenchmark.java b/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/CommonBenchmark.java index 7d770b5dd..6fb2d746b 100644 --- a/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/CommonBenchmark.java +++ b/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/CommonBenchmark.java @@ -50,6 +50,11 @@ public class CommonBenchmark { flowExecutor.execute2Resp("chain2"); } + @Benchmark + public void test3(){ + flowExecutor.execute2Resp("chain3"); + } + public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() diff --git a/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/cmp/DCmp.java b/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/cmp/DCmp.java new file mode 100644 index 000000000..35ee84388 --- /dev/null +++ b/liteflow-benchmark/liteflow-benchmark-common/src/test/java/com/yomahub/liteflow/benchmark/cmp/DCmp.java @@ -0,0 +1,15 @@ +package com.yomahub.liteflow.benchmark.cmp; + +import cn.hutool.core.collection.ListUtil; +import com.yomahub.liteflow.annotation.LiteflowComponent; +import com.yomahub.liteflow.core.NodeIteratorComponent; + +import java.util.Iterator; + +@LiteflowComponent("d") +public class DCmp extends NodeIteratorComponent { + @Override + public Iterator processIterator() throws Exception { + return ListUtil.toList("1","2","3").iterator(); + } +} diff --git a/liteflow-benchmark/liteflow-benchmark-common/src/test/resources/application.properties b/liteflow-benchmark/liteflow-benchmark-common/src/test/resources/application.properties index 55dc0b1ec..deb56e3f8 100644 --- a/liteflow-benchmark/liteflow-benchmark-common/src/test/resources/application.properties +++ b/liteflow-benchmark/liteflow-benchmark-common/src/test/resources/application.properties @@ -1,2 +1,5 @@ liteflow.rule-source=flow.xml -liteflow.print-execution-log=false \ No newline at end of file +liteflow.print-execution-log=false + +liteflow.global-thread-pool-size=500 +liteflow.global-thread-pool-queue-size=1000 \ No newline at end of file diff --git a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopELSpringbootTest.java b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopELSpringbootTest.java index 9332d19e6..3724d5259 100644 --- a/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopELSpringbootTest.java +++ b/liteflow-testcase-el/liteflow-testcase-el-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopELSpringbootTest.java @@ -38,8 +38,12 @@ public class ParallelLoopELSpringbootTest extends BaseTest { //测试并行FOR循环,循环次数直接在el中定义 @Test public void testParallelLoop1() throws Exception { - LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); - Assertions.assertTrue(response.isSuccess()); + + for (int i = 0; i < 10; i++) { + LiteflowResponse response = flowExecutor.execute2Resp("chain1", "arg"); + Assertions.assertTrue(response.isSuccess()); + } + } //测试并行FOR循环,循环次数由For组件定义