This is an automated email from the ASF dual-hosted git repository. hyunkun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-benchmark.git
The following commit(s) were added to refs/heads/master by this push: new 4fad6cb Add ci integration (#5) 4fad6cb is described below commit 4fad6cba66d45385969c33472cac84de4040b9c3 Author: Huang YunKun <hty...@gmail.com> AuthorDate: Thu Jul 18 22:51:31 2019 +0800 Add ci integration (#5) * add args to change config for jmh * add travis file * skip default install * kill server in background * add travis status in readme * add travis status in readme --- .travis.yml | 12 +++++++++ README.md | 2 ++ benchmark.sh | 9 +++++-- client-base/pom.xml | 6 +++++ .../java/org/apache/dubbo/benchmark/Client.java | 30 +++++++++++++++++++--- 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e287f3e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: java + +jdk: + - openjdk8 + +install: true + +script: + - mvn clean package -DskipTests=true -pl benchmark-base,client-base,server-base + - ./benchmark.sh dubbo-kryo-server & + - sleep 20 + - ./benchmark.sh -a "--warmupIterations=1 --warmupTime=1 --measurementIterations=1 --measurementTime=3" dubbo-kryo-client \ No newline at end of file diff --git a/README.md b/README.md index 8d9d2b6..df209f7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Dubbo Benchmark +[![Build Status](https://travis-ci.org/apache/dubbo-benchmark.svg?branch=master)](https://travis-ci.org/apache/dubbo-benchmark) + This project focuses on benchmarking and profiling dubbo framework with the combination of different serialization and transporter options. The code and the idea behinds it is inspired by [RPC Benchmark](https://github.com/hank-whu/rpc-benchmark). ## How To Run Benchmark diff --git a/benchmark.sh b/benchmark.sh index af5f2ff..4f83b75 100755 --- a/benchmark.sh +++ b/benchmark.sh @@ -7,6 +7,7 @@ usage() { echo " -s hostname, host name" echo " -p port, port number" echo " -f output file path" + echo " -a other args" echo "dirname: test module name" } @@ -36,7 +37,7 @@ run() { JAR=`find ${PROJECT_DIR}/target/*.jar | head -n 1` echo echo "RUN ${PROJECT_DIR} IN ${MODE:-benchmark} MODE" - CMD="java ${JAVA_OPTIONS} -Dserver.host=${SERVER} -Dserver.port=${PORT} -Dbenchmark.output=${OUTPUT} -jar ${JAR}" + CMD="java ${JAVA_OPTIONS} -Dserver.host=${SERVER} -Dserver.port=${PORT} -Dbenchmark.output=${OUTPUT} -jar ${JAR} ${OTHERARGS}" echo "command is: ${CMD}" echo ${CMD} @@ -49,8 +50,9 @@ SERVER="localhost" PORT="8080" OUTPUT="" OPTIND=1 +OTHERARGS="" -while getopts "m:s:p:f:" opt; do +while getopts "m:s:p:f:a:" opt; do case "$opt" in m) MODE=${OPTARG} @@ -64,6 +66,9 @@ while getopts "m:s:p:f:" opt; do f) OUTPUT=${OPTARG} ;; + a) + OTHERARGS=${OPTARG} + ;; ?) usage exit 0 diff --git a/client-base/pom.xml b/client-base/pom.xml index d4adb21..9607e04 100644 --- a/client-base/pom.xml +++ b/client-base/pom.xml @@ -47,5 +47,11 @@ <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> </dependencies> </project> \ No newline at end of file diff --git a/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java b/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java index bb57bd7..174abfb 100644 --- a/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java +++ b/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java @@ -1,5 +1,9 @@ package org.apache.dubbo.benchmark; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.Option; import org.apache.dubbo.benchmark.bean.Page; import org.apache.dubbo.benchmark.bean.User; import org.apache.dubbo.benchmark.rpc.AbstractClient; @@ -77,19 +81,37 @@ public class Client extends AbstractClient { } public static void main(String[] args) throws Exception { + System.out.println(args); + org.apache.commons.cli.Options options = new org.apache.commons.cli.Options(); + + options.addOption(Option.builder().longOpt("warmupIterations").hasArg().build()); + options.addOption(Option.builder().longOpt("warmupTime").hasArg().build()); + options.addOption(Option.builder().longOpt("measurementIterations").hasArg().build()); + options.addOption(Option.builder().longOpt("measurementTime").hasArg().build()); + + CommandLineParser parser = new DefaultParser(); + + CommandLine line = parser.parse(options, args); + + int warmupIterations = Integer.valueOf(line.getOptionValue("warmupIterations", "3")); + int warmupTime = Integer.valueOf(line.getOptionValue("warmupTime", "10")); + int measurementIterations = Integer.valueOf(line.getOptionValue("measurementIterations", "3")); + int measurementTime = Integer.valueOf(line.getOptionValue("measurementTime", "10")); + Options opt; ChainedOptionsBuilder optBuilder = new OptionsBuilder() .include(Client.class.getSimpleName()) - .warmupIterations(3) - .warmupTime(TimeValue.seconds(10)) - .measurementIterations(3) - .measurementTime(TimeValue.seconds(10)) + .warmupIterations(warmupIterations) + .warmupTime(TimeValue.seconds(warmupTime)) + .measurementIterations(measurementIterations) + .measurementTime(TimeValue.seconds(measurementTime)) .threads(CONCURRENCY) .forks(1); opt = doOptions(optBuilder).build(); new Runner(opt).run(); + } private static ChainedOptionsBuilder doOptions(ChainedOptionsBuilder optBuilder) {