This is an automated email from the ASF dual-hosted git repository. liujun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push: new 94f0ffe09 Automated Dubbo framework and protocol performance benchmark Benchmark mechanism and platform (#1126) 94f0ffe09 is described below commit 94f0ffe09eb4ffaff71894f0cb25a454367cee61 Author: wxbty <38374721+wx...@users.noreply.github.com> AuthorDate: Tue May 21 09:01:05 2024 +0800 Automated Dubbo framework and protocol performance benchmark Benchmark mechanism and platform (#1126) --- .github/workflows/dubbo-3_2.yml | 24 ++ .github/workflows/dubbo-3_3.yml | 25 ++ 10-task/dubbo-samples-benchmark/README.md | 11 + .../dubbo-samples-benchmark/case-configuration.yml | 86 ++++++ .../case-runtime-parameter.conf | 20 ++ 10-task/dubbo-samples-benchmark/case-versions.conf | 25 ++ .../dubbo-samples-benchmark-agent}/pom.xml | 38 +-- .../agent/CustomizeDubboInstrumentation.java | 93 ++++++ .../benchmark/agent/DubboInvokeInterceptor.java | 55 ++++ .../src/main/resources/skywalking-plugin.def | 18 ++ .../dubbo-samples-benchmark-consumer/pom.xml | 104 +++++++ .../demo/consumer/ConsumerApplication.java | 31 ++ .../src/main/resources/application.yml | 24 ++ .../benchmark/demo/test/ConsumerApplication.java | 31 ++ .../dubbo/benchmark/demo/test/ConsumerIT.java | 263 +++++++++++++++++ .../src/test/resources/consumer.xml | 11 + .../src/test/resources/logback.xml | 1 + .../dubbo-samples-benchmark-interface}/pom.xml | 27 +- .../apache/dubbo/benchmark/demo/DemoService.java | 22 ++ .../dubbo-samples-benchmark-provider/pom.xml | 78 +++++ .../benchmark/demo/provider/DemoServiceImpl.java | 34 +++ .../demo/provider/ProviderApplication.java | 31 ++ .../src/main/resources/application.yml | 24 ++ 10-task/dubbo-samples-benchmark/pom.xml | 195 +++++++++++++ 10-task/pom.xml | 1 + .../dubbo/scenario/builder/ConfigurationImpl.java | 4 + .../src/main/resources/scenario.sh | 10 + test/run-tests.sh | 317 +++++++++++++++------ 28 files changed, 1483 insertions(+), 120 deletions(-) diff --git a/.github/workflows/dubbo-3_2.yml b/.github/workflows/dubbo-3_2.yml index 6c91df24f..6935d198b 100644 --- a/.github/workflows/dubbo-3_2.yml +++ b/.github/workflows/dubbo-3_2.yml @@ -120,6 +120,30 @@ jobs: with: name: test-list path: test/jobs + - name: "Cache Skywalking Agent" + id: cache-skywalking-agent + uses: actions/cache@v4 + with: + path: /tmp/skywalking-agent + key: ${{ runner.os }}-skywalking-agent-9.0.0 + - name: "Cache MySQL Driver" + id: cache-mysql-driver + uses: actions/cache@v4 + with: + path: /tmp/mysql-connector-java-8.0.23.jar + key: ${{ runner.os }}-mysql-driver-8.0.23 + - name: "Download Skywalking Agent and MySQL Driver" + if: steps.cache-skywalking-agent.outputs.cache-hit != 'true' || steps.cache-mysql-driver.outputs.cache-hit != 'true' + run: | + wget -c https://archive.apache.org/dist/skywalking/java-agent/9.0.0/apache-skywalking-java-agent-9.0.0.tgz --no-check-certificate + tar -zxvf apache-skywalking-java-agent-9.0.0.tgz -C /tmp + wget -c https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar + mv mysql-connector-java-8.0.23.jar /tmp/ + - name: "Mvn Benchmark Skywalking Plugin" + run: | + rm -rf /tmp/skywalking-agent/plugins/* + cd 10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent && mvn --batch-mode --no-snapshot-updates -e --no-transfer-progress clean package -Dmaven.test.skip=true -Dmaven.test.skip.exec=true + cp -f ./target/dubbo-samples-benchmark-agent.jar /tmp/skywalking-agent/plugins/ testjob: needs: [prepare_test, build-dubbo] diff --git a/.github/workflows/dubbo-3_3.yml b/.github/workflows/dubbo-3_3.yml index bbbbc53f7..18c1596f2 100644 --- a/.github/workflows/dubbo-3_3.yml +++ b/.github/workflows/dubbo-3_3.yml @@ -121,6 +121,7 @@ jobs: name: test-list path: test/jobs + testjob: needs: [prepare_test, build-dubbo] name: 'Integration Test (Java${{matrix.java}}, Job${{matrix.job_id}})' @@ -164,6 +165,30 @@ jobs: DUBBO_VERSION="${{needs.build-dubbo.outputs.version}}" CANDIDATE_VERSIONS="dubbo.version:$DUBBO_VERSION;compiler.version:$DUBBO_VERSION;dubbo.compiler.version:$DUBBO_VERSION;$CANDIDATE_VERSIONS" echo "CANDIDATE_VERSIONS=$CANDIDATE_VERSIONS" >> $GITHUB_ENV + - name: "Cache Skywalking Agent" + id: cache-skywalking-agent + uses: actions/cache@v4 + with: + path: /tmp/skywalking-agent/dubbo-samples-benchmark-agent.jar + key: ${{ runner.os }}-skywalking-agent-9.0.0 + - name: "Cache MySQL Driver" + id: cache-mysql-driver + uses: actions/cache@v4 + with: + path: /tmp/mysql-connector-java-8.0.23.jar + key: ${{ runner.os }}-mysql-driver-8.0.23 + - name: "Download Skywalking Agent and MySQL Driver" +# if: steps.cache-skywalking-agent.outputs.cache-hit != 'true' || steps.cache-mysql-driver.outputs.cache-hit != 'true' + run: | + wget -c https://archive.apache.org/dist/skywalking/java-agent/9.0.0/apache-skywalking-java-agent-9.0.0.tgz --no-check-certificate + tar -zxvf apache-skywalking-java-agent-9.0.0.tgz -C /tmp + wget -c https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar + mv ./mysql-connector-java-8.0.23.jar /tmp/ + - name: "Mvn Benchmark Skywalking Plugin" + run: | + rm -rf /tmp/skywalking-agent/dubbo-samples-benchmark-agent.jar + cd 10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent && mvn --batch-mode --no-snapshot-updates -e --no-transfer-progress clean package -Dmaven.test.skip=true -Dmaven.test.skip.exec=true + cp -f ./target/dubbo-samples-benchmark-agent.jar /tmp/skywalking-agent/ - name: Build test image run: | cd test && bash ./build-test-image.sh diff --git a/10-task/dubbo-samples-benchmark/README.md b/10-task/dubbo-samples-benchmark/README.md new file mode 100644 index 000000000..232117316 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/README.md @@ -0,0 +1,11 @@ +# Dubbo Spring Boot Benchmark Example + +This example shows how to use automatic benchmark testing for Dubbo projects. Please read [the official documentation]() for more details of how to use + +## Modules +* agent, for skywalking tracing +* interface, provides Dubbo service definition +* provider, implements Dubbo service +* consumer, consumes Dubbo service + + diff --git a/10-task/dubbo-samples-benchmark/case-configuration.yml b/10-task/dubbo-samples-benchmark/case-configuration.yml new file mode 100644 index 000000000..c0a82328f --- /dev/null +++ b/10-task/dubbo-samples-benchmark/case-configuration.yml @@ -0,0 +1,86 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +timeout: 2240 + +services: + zookeeper: + image: zookeeper:latest + + bh-mysql: + image: mysql:5.7 + hostname: bh-mysql + environment: + - MYSQL_ROOT_PASSWORD=123456 + - MYSQL_DATABASE=skywalking + expose: + - 3306 + ports: + - 3306:3306 + healthcheck: + test: [ "CMD", "mysqladmin" ,"ping", "-h", "127.0.0.1" ] + interval: 5s + timeout: 5s + retries: 20 + + skywalking: + image: apache/skywalking-oap-server:9.3.0 + hostname: skywalking + ports: + - 11800:11800 + volumes: + - /tmp/mysql-connector-java-8.0.23.jar:/skywalking/oap-libs/mysql-connector-java-8.0.23.jar + environment: + - SW_STORAGE=mysql + - SW_JDBC_URL=jdbc:mysql://bh-mysql:3306/skywalking?useSSL=false + - SW_DATA_SOURCE_USER=root + - SW_DATA_SOURCE_PASSWORD=123456 + waitPortsBeforeRun: + - bh-mysql:3306 + depends_on: + - bh-mysql + + provider: + type: app + basedir: dubbo-samples-benchmark-provider + mainClass: org.apache.dubbo.benchmark.demo.provider.ProviderApplication + systemProps: + - zookeeper.address=zookeeper + waitPortsBeforeRun: + - zookeeper:2181 + checkPorts: + - 20880 + checkLog: "Current Spring Boot Application is await..." + + test: + type: test + basedir: dubbo-samples-benchmark-consumer + tests: + - "**/*IT.class" + jvmFlags: + - "-javaagent:/tmp/skywalking-agent/skywalking-agent.jar" + systemProps: + - zookeeper.address=zookeeper + - skywalking.agent.service_name=dubbo-samples-benchmark-consumer + - skywalking.collector.backend_service=skywalking:11800 + volumes: + - /tmp:/tmp + waitPortsBeforeRun: + - zookeeper:2181 + - provider:20880 + - skywalking:11800 + depends_on: + - provider diff --git a/10-task/dubbo-samples-benchmark/case-runtime-parameter.conf b/10-task/dubbo-samples-benchmark/case-runtime-parameter.conf new file mode 100644 index 000000000..81558fc25 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/case-runtime-parameter.conf @@ -0,0 +1,20 @@ +# +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +-Ddubbo.protocol.name=dubbo -Ddubbo.protocol.serialization=hessian2 + diff --git a/10-task/dubbo-samples-benchmark/case-versions.conf b/10-task/dubbo-samples-benchmark/case-versions.conf new file mode 100644 index 000000000..5b2f9102c --- /dev/null +++ b/10-task/dubbo-samples-benchmark/case-versions.conf @@ -0,0 +1,25 @@ +# +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +# Supported component versions of the test case + +# Spring app +dubbo.version=3.3.* +spring.version=5.* +java.version=8 diff --git a/10-task/pom.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/pom.xml similarity index 50% copy from 10-task/pom.xml copy to 10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/pom.xml index 42091170b..1a4cb7e2f 100644 --- a/10-task/pom.xml +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/pom.xml @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,23 +14,30 @@ See the License for the specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>dubbo-samples-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.dubbo</groupId> - <artifactId>10-task</artifactId> - <packaging>pom</packaging> - <version>1.0-SNAPSHOT</version> + <artifactId>dubbo-samples-benchmark-agent</artifactId> - <name>Task</name> - <description>Dubbo Learning Task</description> + <dependencies> + <dependency> + <groupId>org.apache.skywalking</groupId> + <artifactId>apm-agent</artifactId> + <version>9.1.0</version> + <scope>provided</scope> + </dependency> - <modules> - <module>dubbo-samples-rpc-basic</module> - <module>dubbo-samples-rpc-advanced</module> - <module>dubbo-samples-shop</module> - <module>dubbo-samples-metrics-demo</module> - <module>dubbo-samples-develop</module> - <module>dubbo-samples-extensibility</module> - </modules> + </dependencies> + + <build> + <finalName>${project.artifactId}</finalName> + </build> </project> diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/CustomizeDubboInstrumentation.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/CustomizeDubboInstrumentation.java new file mode 100644 index 000000000..028bd3fc1 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/CustomizeDubboInstrumentation.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.dubbo.benchmark.agent; + +import org.apache.dubbo.remoting.Codec2; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.MultiClassNameMatch; +import org.apache.skywalking.apm.agent.core.plugin.match.logical.LogicalMatchOperation; +import org.apache.skywalking.apm.dependencies.net.bytebuddy.description.method.MethodDescription; +import org.apache.skywalking.apm.dependencies.net.bytebuddy.matcher.ElementMatcher; + +import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch; +import static org.apache.skywalking.apm.dependencies.net.bytebuddy.matcher.ElementMatchers.namedOneOf; + +public class CustomizeDubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + private static final String RPC_INVOKER = "org.apache.dubbo.rpc.protocol.AbstractInvoker"; + + private static final String RemoteInvocation = "org.springframework.remoting.support.RemoteInvocation"; + + private static final String Serialization = "org.apache.dubbo.common.serialize.Serialization"; + + public static final String InvokerInvocationHandler = "org.apache.dubbo.rpc.proxy.InvokerInvocationHandler"; + + public static final String Codec2 = "org.apache.dubbo.remoting.Codec2"; + + public static final String Codec = "org.apache.dubbo.remoting.Codec"; + + public static final String Decodeable = "org.apache.dubbo.remoting.Decodeable"; + + public static final String DemoService = "org.apache.dubbo.benchmark.demo.DemoService"; + + public static final String INTERCEPT_CLASS = "org.apache.dubbo.benchmark.agent.DubboInvokeInterceptor"; + + @Override + protected ClassMatch enhanceClass() { + return LogicalMatchOperation.or(byHierarchyMatch(RemoteInvocation) + , byHierarchyMatch(RPC_INVOKER) + , byHierarchyMatch(Codec) + , byHierarchyMatch(Codec2) + , byHierarchyMatch(Decodeable) + , byHierarchyMatch(Serialization) + , byHierarchyMatch(DemoService) + , MultiClassNameMatch.byMultiClassMatch(InvokerInvocationHandler)); + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return null; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[]{ + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher<MethodDescription> getMethodsMatcher() { + return namedOneOf("doInvoke", "invoke", "encode", "decode", "serialize", "deserialize", "sayHello"); + } + + @Override + public String getMethodsInterceptor() { + return INTERCEPT_CLASS; + } + + @Override + public boolean isOverrideArgs() { + return false; + } + } + }; + } + +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/DubboInvokeInterceptor.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/DubboInvokeInterceptor.java new file mode 100644 index 000000000..372df5fda --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/java/org/apache/dubbo/benchmark/agent/DubboInvokeInterceptor.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.dubbo.benchmark.agent; + +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.agent.core.util.MethodUtil; + +import java.lang.reflect.Method; + + +public class DubboInvokeInterceptor implements InstanceMethodsAroundInterceptor { + @Override + public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, + MethodInterceptResult result) { + ContextManager.createLocalSpan(MethodUtil.generateOperationName(method)); + } + + @Override + public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, + Object ret) { + try { + ContextManager.activeSpan(); + } finally { + ContextManager.stopSpan(); + } + return ret; + } + + @Override + public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, + Class<?>[] argumentsTypes, Throwable t) { + if (ContextManager.isActive()) { + ContextManager.activeSpan().log(t); + } + } +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/resources/skywalking-plugin.def b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/resources/skywalking-plugin.def new file mode 100644 index 000000000..68ba834b6 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-agent/src/main/resources/skywalking-plugin.def @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dubbo-trace=org.apache.dubbo.benchmark.agent.CustomizeDubboInstrumentation + diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/pom.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/pom.xml new file mode 100644 index 000000000..b3a45557e --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/pom.xml @@ -0,0 +1,104 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>dubbo-samples-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>dubbo-samples-benchmark-consumer</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-samples-benchmark-interface</artifactId> + <version>${project.parent.version}</version> + </dependency> + + <!-- dubbo --> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-dependencies-zookeeper</artifactId> + <type>pom</type> + <exclusions> + <exclusion> + <artifactId>slf4j-reload4j</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + + <!-- spring starter --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + </dependency> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + </dependency> + + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.4</version> + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>8.0.23</version> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/java/org/apache/dubbo/benchmark/demo/consumer/ConsumerApplication.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/java/org/apache/dubbo/benchmark/demo/consumer/ConsumerApplication.java new file mode 100644 index 000000000..123f38345 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/java/org/apache/dubbo/benchmark/demo/consumer/ConsumerApplication.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dubbo.benchmark.demo.consumer; + +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableDubbo +public class ConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(ConsumerApplication.class, args); + } +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/resources/application.yml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/resources/application.yml new file mode 100644 index 000000000..9a7a8fe1f --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/main/resources/application.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dubbo: + application: + name: dubbo-springboot-demo-consumer + protocol: + name: dubbo + port: -1 + registry: + address: zookeeper://${zookeeper.address:127.0.0.1}:2181 diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerApplication.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerApplication.java new file mode 100644 index 000000000..86e4a22b8 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerApplication.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dubbo.benchmark.demo.test; + +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableDubbo +public class ConsumerApplication { + + public static void main(String[] args) { + SpringApplication.run(ConsumerApplication.class, args); + } +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerIT.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerIT.java new file mode 100644 index 000000000..ce841627e --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/java/org/apache/dubbo/benchmark/demo/test/ConsumerIT.java @@ -0,0 +1,263 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.benchmark.demo.test; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import org.apache.commons.io.FileUtils; +import org.apache.dubbo.benchmark.demo.DemoService; +import org.apache.dubbo.config.ReferenceConfig; +import org.apache.dubbo.config.RegistryConfig; +import org.apache.dubbo.config.bootstrap.DubboBootstrap; +import org.apache.dubbo.config.bootstrap.builders.ReferenceBuilder; +import org.junit.Test; +import org.junit.platform.commons.util.StringUtils; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.results.format.ResultFormatType; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Base64; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class ConsumerIT { + + String propKey = "prop"; + + @Test + public void test() throws Exception { + + String prop = System.getProperty(propKey); + String propJson = null; + + if (StringUtils.isNotBlank(prop)) { + prop = prop.replace("\"", ""); + String[] props = prop.split("\\|"); + + Map<String, String> propMap = new HashMap<>(); + List<String> propList = new ArrayList<>(); + for (String p : props) { + p = p.substring(2); + String key = p.substring(0, p.indexOf("=")); + String val = p.substring(p.indexOf("=") + 1); + propMap.put(key, val); + propList.add(p); + } + propJson = new Gson().toJson(propMap); + prop = String.join("_", propList); + } + + String sampleFileName = runSample(propJson, prop); + + dotTrace(prop, propKey, propJson); + + String throughputFileName = runThroughput(propJson); + + mergeResult(sampleFileName, throughputFileName); + + } + + private static void mergeResult(String sampleFileName, String throughputFileName) throws IOException { + String sampleResultJson = FileUtils.readFileToString(new File(sampleFileName), "UTF-8"); + String throughputResultJson = FileUtils.readFileToString(new File(throughputFileName), "UTF-8"); + + Gson gson = new Gson(); + List firstResults = gson.fromJson(sampleResultJson, List.class); + List secondResults = gson.fromJson(throughputResultJson, List.class); + + firstResults.addAll(secondResults); + + String mergedResultJson = gson.toJson(firstResults); + FileUtils.writeStringToFile(new File(sampleFileName), mergedResultJson, "UTF-8"); + } + + private String runSample(String propJson, String prop) throws Exception { + String fileName; + if (StringUtils.isNotBlank(prop)) { + fileName = "/tmp/jmh_result_prop[" + prop + "]_" + UUID.randomUUID() + ".json"; + } else { + fileName = "/tmp/jmh_result_" + UUID.randomUUID() + ".json"; + } + + Options options = new OptionsBuilder() + .include(MyBenchmark.class.getSimpleName()) + .param("time", System.currentTimeMillis() + "") + .param("prop", propJson == null ? "" : propJson) + .resultFormat(ResultFormatType.JSON) + .result(fileName) + .mode(Mode.SampleTime) + .threads(32) + .forks(1) + .build(); + + new Runner(options).run(); + + return fileName; + } + + private static String runThroughput(String propJson) throws Exception { + String fileName = "/tmp/" + UUID.randomUUID() + ".json"; + + Options options = new OptionsBuilder() + .include(MyBenchmark.class.getSimpleName()) + .param("time", System.currentTimeMillis() + "") + .param("prop", propJson == null ? "" : propJson) + .resultFormat(ResultFormatType.JSON) + .result(fileName) + .jvmArgs("-Dzookeeper.address=zookeeper") + .mode(Mode.Throughput) + .threads(32) + .forks(1) + .build(); + + new Runner(options).run(); + + return fileName; + } + + private static void dotTrace(String prop, String propKey, String propJson) { + String url = "jdbc:mysql://bh-mysql:3306/skywalking?useSSL=false"; + String user = "root"; + String password = "123456"; + + Connection connection = null; + PreparedStatement statement = null; + ResultSet resultSet = null; + String dataBinary = null; + + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + connection = DriverManager.getConnection(url, user, password); + + String setOffsetSql = "SELECT FLOOR(COUNT(*) * 0.01) FROM segment"; + statement = connection.prepareStatement(setOffsetSql); + resultSet = statement.executeQuery(); + + if (resultSet.next()) { + int offset = resultSet.getInt(1); + System.out.println("offset:" + offset); + + String querySql = "SELECT data_binary FROM segment ORDER BY latency DESC LIMIT 1 OFFSET ?"; + statement = connection.prepareStatement(querySql); + statement.setInt(1, offset); + resultSet = statement.executeQuery(); + + if (resultSet.next()) { + dataBinary = resultSet.getString("data_binary"); + System.out.println(dataBinary); + } + } + + Class<?> segmentObjectClass = Class.forName("org.apache.skywalking.apm.network.language.agent.v3.SegmentObject"); + + Object segmentObject = new Object(); + if (StringUtils.isNotBlank(dataBinary)) { + byte[] bytes = Base64.getDecoder().decode(dataBinary); + segmentObject = segmentObjectClass.getDeclaredMethod("parseFrom", byte[].class).invoke(null, bytes); + } + + String traceFileName; + if (StringUtils.isNotBlank(prop)) { + traceFileName = "/tmp/jmh_trace_prop[" + prop + "].json"; + } else { + traceFileName = "/tmp/jmh_trace.json"; + } + + String traceJson; + Gson gson = new Gson(); + if (StringUtils.isNotBlank(propJson)) { + JsonElement jsonElement = gson.toJsonTree(segmentObject); + jsonElement.getAsJsonObject().addProperty(propKey, propJson); + traceJson = gson.toJson(jsonElement); + } else { + traceJson = gson.toJson(segmentObject); + } + + traceJson = "[" + traceJson + "]"; + + FileUtils.write(new File(traceFileName), traceJson, Charset.defaultCharset(), false); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("dotTrace error"); + } finally { + try { + if (resultSet != null) { + resultSet.close(); + } + if (statement != null) { + statement.close(); + } + if (connection != null) { + connection.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + } + + @State(Scope.Benchmark) + public static class MyBenchmark { + + private final DemoService service; + + public MyBenchmark() { + String zkAddr = System.getProperty("zookeeper.address", "127.0.0.1"); + ReferenceConfig<DemoService> reference = + ReferenceBuilder.<DemoService>newBuilder() + .interfaceClass(DemoService.class) + .addRegistry(new RegistryConfig("zookeeper://" + zkAddr + ":2181")) + .build(); + DubboBootstrap bootstrap = DubboBootstrap.getInstance(); + bootstrap.application("dubbo-benchmark-consumer"); + bootstrap.reference(reference).start(); + service = reference.get(); + } + + @Param({""}) + private String time; + + @Param({""}) + private String prop; + + @Benchmark + public String getUser() { + return service.sayHello("dubbo"); + } + + } + +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/consumer.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/consumer.xml new file mode 100644 index 000000000..d607b0fb5 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/consumer.xml @@ -0,0 +1,11 @@ +<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" + xmlns="http://www.springframework.org/schema/beans" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"> + <dubbo:application name="dubbo-benchmark-client"/> + <dubbo:reference id="demoService" check="false" + interface="org.apache.dubbo.benchmark.demo.DemoService" + url="dubbo://localhost:20880"/> + <dubbo:consumer client="netty4" filter="-default"/> +</beans> \ No newline at end of file diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/logback.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/logback.xml new file mode 100644 index 000000000..00f84436a --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-consumer/src/test/resources/logback.xml @@ -0,0 +1 @@ +<logger name="org.apache.dubbo" level="INFO"/> diff --git a/10-task/pom.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/pom.xml similarity index 51% copy from 10-task/pom.xml copy to 10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/pom.xml index 42091170b..5b2b8b491 100644 --- a/10-task/pom.xml +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/pom.xml @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,23 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>dubbo-samples-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.dubbo</groupId> - <artifactId>10-task</artifactId> - <packaging>pom</packaging> - <version>1.0-SNAPSHOT</version> + <artifactId>dubbo-samples-benchmark-interface</artifactId> - <name>Task</name> - <description>Dubbo Learning Task</description> - - <modules> - <module>dubbo-samples-rpc-basic</module> - <module>dubbo-samples-rpc-advanced</module> - <module>dubbo-samples-shop</module> - <module>dubbo-samples-metrics-demo</module> - <module>dubbo-samples-develop</module> - <module>dubbo-samples-extensibility</module> - </modules> </project> diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/src/main/java/org/apache/dubbo/benchmark/demo/DemoService.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/src/main/java/org/apache/dubbo/benchmark/demo/DemoService.java new file mode 100644 index 000000000..9962e8000 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-interface/src/main/java/org/apache/dubbo/benchmark/demo/DemoService.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.benchmark.demo; + +public interface DemoService { + + String sayHello(String name); +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/pom.xml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/pom.xml new file mode 100644 index 000000000..cdaf0158b --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/pom.xml @@ -0,0 +1,78 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>dubbo-samples-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>dubbo-samples-benchmark-provider</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-samples-benchmark-interface</artifactId> + <version>${project.parent.version}</version> + </dependency> + + <!-- dubbo --> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId> + <type>pom</type> + <exclusions> + <exclusion> + <artifactId>slf4j-reload4j</artifactId> + <groupId>org.slf4j</groupId> + </exclusion> + </exclusions> + </dependency> + + <!-- spring starter --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/DemoServiceImpl.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/DemoServiceImpl.java new file mode 100644 index 000000000..e0a444569 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/DemoServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.benchmark.demo.provider; + + +import org.apache.dubbo.benchmark.demo.DemoService; +import org.apache.dubbo.config.annotation.DubboService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@DubboService +public class DemoServiceImpl implements DemoService { + + Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class); + + @Override + public String sayHello(String name) { + return "Hello " + name; + } +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/ProviderApplication.java b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/ProviderApplication.java new file mode 100644 index 000000000..caef5d933 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/java/org/apache/dubbo/benchmark/demo/provider/ProviderApplication.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dubbo.benchmark.demo.provider; + + +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableDubbo +public class ProviderApplication { + public static void main(String[] args) { + SpringApplication.run(ProviderApplication.class, args); + } +} diff --git a/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/resources/application.yml b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/resources/application.yml new file mode 100644 index 000000000..4765927dc --- /dev/null +++ b/10-task/dubbo-samples-benchmark/dubbo-samples-benchmark-provider/src/main/resources/application.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dubbo: + application: + name: dubbo-springboot-demo-provider + protocol: + name: dubbo + port: 20880 + registry: + address: zookeeper://${zookeeper.address:127.0.0.1}:2181 diff --git a/10-task/dubbo-samples-benchmark/pom.xml b/10-task/dubbo-samples-benchmark/pom.xml new file mode 100644 index 000000000..545df97c6 --- /dev/null +++ b/10-task/dubbo-samples-benchmark/pom.xml @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>23</version> + <relativePath/> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-samples-benchmark</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Dubbo Samples benchmark</name> + <description>Dubbo Samples benchmark</description> + + <properties> + <dubbo.version>3.3.0-beta.1</dubbo.version> + <junit.version>4.13.1</junit.version> + <spring-boot.version>2.7.8</spring-boot.version> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + <jmh.version>1.37</jmh.version> + </properties> + + <modules> + <module>dubbo-samples-benchmark-interface</module> + <module>dubbo-samples-benchmark-provider</module> + <module>dubbo-samples-benchmark-consumer</module> + </modules> + + <dependencyManagement> + <dependencies> + <!-- Spring Boot --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-bom</artifactId> + <version>${dubbo.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-dependencies-zookeeper-curator5</artifactId> + <version>${dubbo.version}</version> + <type>pom</type> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + <version>${jmh.version}</version> + </dependency> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + <version>${jmh.version}</version> + </dependency> + + + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>4.26.0</version> + </dependency> + + <!--fastjson--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-fastjson</artifactId> + <version>2.7.23</version> + <exclusions> + <exclusion> + <artifactId>javassist</artifactId> + <groupId>org.javassist</groupId> + </exclusion> + </exclusions> + </dependency> + + <!--avro--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-avro</artifactId> + <version>2.7.23</version> + </dependency> + + <!--fst--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-fst</artifactId> + <version>2.7.23</version> + <exclusions> + <exclusion> + <artifactId>javassist</artifactId> + <groupId>org.javassist</groupId> + </exclusion> + </exclusions> + </dependency> + + <!--gson--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-gson</artifactId> + <version>2.7.23</version> + </dependency> + + <!--kryo 有问题 报String cast to map异常--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-kryo</artifactId> + <version>2.7.23</version> + </dependency> + + <!--msgpack 有问题 https://github.com/apache/dubbo/issues/12580--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-serialization-msgpack</artifactId> + <version>2.7.23</version> + </dependency> + + <!--rmi--> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-rpc-rmi</artifactId> + <version>2.7.23</version> + </dependency> + + </dependencies> + + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/10-task/pom.xml b/10-task/pom.xml index 42091170b..87d68cb92 100644 --- a/10-task/pom.xml +++ b/10-task/pom.xml @@ -33,5 +33,6 @@ <module>dubbo-samples-metrics-demo</module> <module>dubbo-samples-develop</module> <module>dubbo-samples-extensibility</module> + <module>dubbo-samples-benchmark</module> </modules> </project> diff --git a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java index 545aa8611..941430939 100644 --- a/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java +++ b/test/dubbo-scenario-builder/src/main/java/org/apache/dubbo/scenario/builder/ConfigurationImpl.java @@ -515,6 +515,10 @@ public class ConfigurationImpl implements IConfiguration { for (String propkv : systemProps) { sb.append("-D").append(propkv).append(' '); } + String runtimeProps = System.getProperty("prop"); + if (StringUtils.isNotBlank(runtimeProps)) { + sb.append(runtimeProps).append(' '); + } return sb.toString(); } diff --git a/test/dubbo-scenario-builder/src/main/resources/scenario.sh b/test/dubbo-scenario-builder/src/main/resources/scenario.sh index b44240f72..d02249e9c 100644 --- a/test/dubbo-scenario-builder/src/main/resources/scenario.sh +++ b/test/dubbo-scenario-builder/src/main/resources/scenario.sh @@ -227,6 +227,16 @@ else done fi +for service_name in ${service_names[@]};do + echo "--------------$service_name-----------" + cat $SCENARIO_HOME/logs/${service_name}.log + echo "--------------"$service_name"_end-----------" +done + +echo "--------------scenario_log-----------" +cat $scenario_log +echo "--------------scenario_log_end-----------" + # rm network docker network rm $network_name 2>&1 | tee -a $scenario_log > /dev/null diff --git a/test/run-tests.sh b/test/run-tests.sh index aff10457f..b29df6ff1 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -65,6 +65,7 @@ ERROR_MSG_FLAG=":ErrorMsg:" CONFIG_FILE="case-configuration.yml" VERSONS_FILE="case-versions.conf" +RUNTIME_PARAMETER_FILE="case-runtime-parameter.conf" VERSIONS_SOURCE_FILE="case-version-sources.conf" # Exit codes @@ -113,68 +114,11 @@ function check_test_image() { fi } -function process_case() { - case_dir=$1 - case_no=$2 - - if [ -f $case_dir ]; then - case_dir=`dirname $case_dir` - fi - - file=$case_dir/$CONFIG_FILE - if [ ! -f $file ]; then - echo "$TEST_FAILURE: case config not found: $file" | tee -a $testResultFile - return 1 - fi - - ver_file=$case_dir/$VERSONS_FILE - if [ ! -f $ver_file ]; then - echo "$TEST_FAILURE: case versions config not found: $ver_file" | tee -a $testResultFile - return 1 - fi - - ver_src_file=$case_dir/$VERSIONS_SOURCE_FILE - - case_start_time=$SECONDS - project_home=`dirname $file` - scenario_home=$project_home/target - scenario_name=`basename $project_home` - log_prefix="[${case_no}/${totalCount}] [$scenario_name]" - echo "$log_prefix Processing : $project_home .." +function run_test_with_version_profile() { + local version_profile=$1 + local parameter_runtime=$2 + local project_home=$3 - # generate version matrix - version_log_file=$project_home/version-matrix.log - version_matrix_file=$project_home/version-matrix.txt - java -DcandidateVersions="$CANDIDATE_VERSIONS" \ - -DcaseVersionsFile="$ver_file" \ - -DcaseVersionSourcesFile="$ver_src_file" \ - -DoutputFile="$version_matrix_file" \ - -cp $test_builder_jar \ - org.apache.dubbo.scenario.builder.VersionMatcher &> $version_log_file - result=$? - if [ $result -ne 0 ]; then - #extract error msg - error_msg=`get_error_msg $version_log_file` - - if [ $result -eq $EXIT_UNMATCHED ]; then - echo "$log_prefix $TEST_IGNORED: Version not match:$error_msg" | tee -a $testResultFile - else - echo "$log_prefix $TEST_FAILURE: Generate version matrix failed:$error_msg" | tee -a $testResultFile - if [ "$SHOW_ERROR_DETAIL" == "1" ];then - print_log_file $scenario_name $version_log_file - else - echo "please check log file: $version_log_file" - fi - fi - return 1 - fi - - version_count=`grep -c "" $version_matrix_file ` - echo "$log_prefix Version matrix: $version_count" - cat $version_matrix_file - - version_no=0 - while read -r version_profile; do start_time=$SECONDS version_no=$((version_no + 1)) log_prefix="[${case_no}/${totalCount}] [$scenario_name:$version_no/$version_count]" @@ -191,39 +135,55 @@ function process_case() { find . -name target -d | xargs -I {} sudo rm -rf {} fi - mvn $BUILD_OPTS $version_profile &> $project_home/mvn.log + jvm_opts=$version_profile + if [ "$parameter_runtime" != "" ]; then + # 检查参数数量 + IFS=' ' read -ra params <<< "$parameter_runtime" + num_params=${#params[@]} + if [ "$num_params" -gt 1 ]; then + output_params=$(echo "$parameter_runtime" | awk '{ for(i=1; i<=NF; i++) printf "%s%s", $i, (i==NF ? ORS : "|"); }') + else + output_params="$parameter_runtime" + fi + jvm_opts="$version_profile $parameter_runtime -Dprop=\"$output_params\"" + fi + + echo "jvm_opts=$jvm_opts" + mvn $BUILD_OPTS $jvm_opts &> $project_home/mvn.log result=$? if [ $result -ne 0 ]; then - echo "$log_prefix $TEST_FAILURE: Build failure with version: $version_profile, please check log: $project_home/mvn.log" | tee -a $testResultFile + echo "$log_prefix $TEST_FAILURE: Build failure with version: $jvm_opts, please check log: $project_home/mvn.log" | tee -a $testResultFile + echo "mvn $BUILD_OPTS $jvm_opts" if [ "$SHOW_ERROR_DETAIL" == "1" ];then cat $project_home/mvn.log fi return 1 fi - # generate case configuration - mkdir -p $scenario_home/logs - scenario_builder_log=$scenario_home/logs/scenario-builder.log - echo "$log_prefix Generating test case configuration .." - config_time=$SECONDS - java -Dconfigure.file=$file \ - -Dscenario.home=$scenario_home \ - -Dscenario.name=$scenario_name \ - -Dscenario.version=$version \ - -Dtest.image.version=$JAVA_VER \ - -Ddebug.service=$DEBUG \ - $version_profile \ - -jar $test_builder_jar &> $scenario_builder_log - result=$? - if [ $result -ne 0 ]; then - error_msg=`get_error_msg $scenario_builder_log` - if [ $result == $EXIT_IGNORED ]; then - echo "$log_prefix $TEST_IGNORED: $error_msg" | tee -a $testResultFile - else - echo "$log_prefix $TEST_FAILURE: Generate case configuration failure: $error_msg, please check log: $scenario_builder_log" | tee -a $testResultFile - fi - return $result - fi + # generate case configuration + mkdir -p $scenario_home/logs + scenario_builder_log=$scenario_home/logs/scenario-builder.log + echo "$log_prefix Generating test case configuration .." + config_time=$SECONDS + java -Dconfigure.file=$file \ + -Dscenario.home=$scenario_home \ + -Dscenario.name=$scenario_name \ + -Dscenario.version=$version \ + -Dtest.image.version=$JAVA_VER \ + -Ddebug.service=$DEBUG \ + $version_profile \ + -Dprop="$jvm_opts" \ + -jar $test_builder_jar &> $scenario_builder_log + result=$? + if [ $result -ne 0 ]; then + error_msg=`get_error_msg $scenario_builder_log` + if [ $result == $EXIT_IGNORED ]; then + echo "$log_prefix $TEST_IGNORED: $error_msg" | tee -a $testResultFile + else + echo "$log_prefix $TEST_FAILURE: Generate case configuration failure: $error_msg, please check log: $scenario_builder_log" | tee -a $testResultFile + fi + return $result + fi # run test echo "$log_prefix Running test case .." @@ -263,7 +223,190 @@ function process_case() { return 1 fi - done < $version_matrix_file +} + +function process_case() { + case_dir=$1 + case_no=$2 + + if [ -f $case_dir ]; then + case_dir=`dirname $case_dir` + fi + + file=$case_dir/$CONFIG_FILE + if [ ! -f $file ]; then + echo "$TEST_FAILURE: case config not found: $file" | tee -a $testResultFile + return 1 + fi + + ver_file=$case_dir/$VERSONS_FILE + if [ ! -f $ver_file ]; then + echo "$TEST_FAILURE: case versions config not found: $ver_file" | tee -a $testResultFile + return 1 + fi + + runtime_parameter_file=$case_dir/$RUNTIME_PARAMETER_FILE + ver_src_file=$case_dir/$VERSIONS_SOURCE_FILE + + case_start_time=$SECONDS + project_home=`dirname $file` + scenario_home=$project_home/target + scenario_name=`basename $project_home` + log_prefix="[${case_no}/${totalCount}] [$scenario_name]" + echo "$log_prefix Processing : $project_home .." + + runtime_count=0 + if [ ! -f $runtime_parameter_file ]; then + echo "case runtime config not found: $runtime_parameter_file" + else + content=$(grep -v '^\s*#' "$runtime_parameter_file" | grep -v '^$') + echo "$content" > "$runtime_parameter_file" + runtime_count=`grep -vc '^$' $runtime_parameter_file ` + echo "$log_prefix Runtime parameter: $runtime_count" + cat $runtime_parameter_file + fi + echo "runtime_count=$runtime_count" + + includeCaseSpecificVersion=true + if [ $runtime_count -gt 0 ]; then + includeCaseSpecificVersion=fasle; + fi + + # generate version matrix + version_log_file=$project_home/version-matrix.log + version_matrix_file=$project_home/version-matrix.txt + java -DcandidateVersions="$CANDIDATE_VERSIONS" \ + -DcaseVersionsFile="$ver_file" \ + -DcaseVersionSourcesFile="$ver_src_file" \ + -DoutputFile="$version_matrix_file" \ + -DincludeCaseSpecificVersion=$includeCaseSpecificVersion \ + -cp $test_builder_jar \ + org.apache.dubbo.scenario.builder.VersionMatcher &> $version_log_file + result=$? + + echo "version_log_file=$version_log_file" + echo "result=$result" + cat $version_log_file + + if [ $result -ne 0 ]; then + #extract error msg + error_msg=`get_error_msg $version_log_file` + + if [ $result -eq $EXIT_UNMATCHED ]; then + echo "$log_prefix $TEST_IGNORED: Version not match:$error_msg" | tee -a $testResultFile + else + echo "$log_prefix $TEST_FAILURE: Generate version matrix failed:$error_msg" | tee -a $testResultFile + if [ "$SHOW_ERROR_DETAIL" == "1" ];then + print_log_file $scenario_name $version_log_file + else + echo "please check log file: $version_log_file" + fi + fi + return 1 + fi + + version_count=`grep -c "" $version_matrix_file ` + echo "$log_prefix Version matrix: $version_count" + cat $version_matrix_file + + if [ $runtime_count -gt 0 ]; then + while read -r version_profile; do + while read -r parameter_runtime; do + echo "do parameter_runtime=$parameter_runtime" + run_test_with_version_profile "$version_profile" "$parameter_runtime" "$project_home" + done < "$runtime_parameter_file" + done < "$version_matrix_file" + else + while read -r version_profile; do + start_time=$SECONDS + version_no=$((version_no + 1)) + log_prefix="[${case_no}/${totalCount}] [$scenario_name:$version_no/$version_count]" + + # run test using version profile + echo "$log_prefix Building project : $scenario_name with version: $version_profile .." + cd $project_home + + # clean target manual, avoid 'mvn clean' failed with 'Permission denied' in github actions + find . -name target -d | xargs -I {} rm -rf {} + target_dirs=`find . -name target -d` + if [ "$target_dirs" != "" ]; then + echo "$log_prefix Force delete target dirs" + find . -name target -d | xargs -I {} sudo rm -rf {} + fi + + mvn $BUILD_OPTS $version_profile &> $project_home/mvn.log + result=$? + if [ $result -ne 0 ]; then + echo "$log_prefix $TEST_FAILURE: Build failure with version: $version_profile, please check log: $project_home/mvn.log" | tee -a $testResultFile + if [ "$SHOW_ERROR_DETAIL" == "1" ];then + cat $project_home/mvn.log + fi + return 1 + fi + + # generate case configuration + mkdir -p $scenario_home/logs + scenario_builder_log=$scenario_home/logs/scenario-builder.log + echo "$log_prefix Generating test case configuration .." + config_time=$SECONDS + java -Dconfigure.file=$file \ + -Dscenario.home=$scenario_home \ + -Dscenario.name=$scenario_name \ + -Dscenario.version=$version \ + -Dtest.image.version=$JAVA_VER \ + -Ddebug.service=$DEBUG \ + $version_profile \ + -jar $test_builder_jar &> $scenario_builder_log + result=$? + if [ $result -ne 0 ]; then + error_msg=`get_error_msg $scenario_builder_log` + if [ $result == $EXIT_IGNORED ]; then + echo "$log_prefix $TEST_IGNORED: $error_msg" | tee -a $testResultFile + else + echo "$log_prefix $TEST_FAILURE: Generate case configuration failure: $error_msg, please check log: $scenario_builder_log" | tee -a $testResultFile + fi + return $result + fi + + # run test + echo "$log_prefix Running test case .." + running_time=$SECONDS + bash $scenario_home/scenario.sh + result=$? + end_time=$SECONDS + + if [ $result == 0 ]; then + echo "$log_prefix $TEST_SUCCESS with version: $version_profile, cost $((end_time - start_time)) s" + else + scenario_log=$scenario_home/logs/scenario.log + error_msg=`get_error_msg $scenario_log` + if [ $result == $EXIT_IGNORED ]; then + if [ "$error_msg" != "" ];then + echo "$log_prefix $TEST_IGNORED: $error_msg, version: $version_profile" | tee -a $testResultFile + else + echo "$log_prefix $TEST_IGNORED, version: $version_profile, please check logs: $scenario_home/logs" | tee -a $testResultFile + fi + else + if [ "$error_msg" != "" ];then + echo "$log_prefix $TEST_FAILURE: $error_msg, version: $version_profile, please check logs: $scenario_home/logs" | tee -a $testResultFile + else + echo "$log_prefix $TEST_FAILURE, version: $version_profile, please check logs: $scenario_home/logs" | tee -a $testResultFile + fi + fi + + # show test log + if [ "$SHOW_ERROR_DETAIL" == "1" ]; then + for log_file in $scenario_home/logs/*.log; do + # ignore scenario-builder.log + if [[ $log_file != *scenario-builder.log ]]; then + print_log_file $scenario_name $log_file + fi + done + fi + return 1 + fi + done < "$version_matrix_file" + fi log_prefix="[${case_no}/${totalCount}] [$scenario_name]" echo "$log_prefix $TEST_SUCCESS: versions: $version_count, total cost $((end_time - case_start_time)) s" | tee -a $testResultFile --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org