Skip to content
Permalink
Browse files
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
  • Loading branch information
htynkn committed Jul 18, 2019
1 parent a8be15a commit 4fad6cba66d45385969c33472cac84de4040b9c3
Showing 5 changed files with 53 additions and 6 deletions.
@@ -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
@@ -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
@@ -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
@@ -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>
@@ -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 Page<User> listUser() throws Exception {
}

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) {

0 comments on commit 4fad6cb

Please sign in to comment.