This is an automated email from the ASF dual-hosted git repository. alexstocks pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/dubbo-benchmark.git
commit 1f21438105c964d15b5d202c1b405807539f154c Author: beiwei30 <[email protected]> AuthorDate: Thu May 24 16:04:36 2018 +0800 add fst support, simplify project structure --- .gitignore | 4 + benchmark.sh | 4 +- client-base/pom.xml | 51 ++++++++++++ .../src/main/java/org/apache/dubbo/Client.java | 15 ++++ .../java/org/apache/dubbo/benchmark/Client.java | 2 +- .../src/main/resources/benchmark.properties | 0 .../src/main/resources/logback.xml | 8 +- .../pom.xml | 37 ++------- .../src/main/resources/consumer.xml | 8 +- .../src/main/resources/logback.xml | 10 +-- .../pom.xml | 37 ++------- .../src/main/resources/provider.xml | 14 ++-- dubbo-hessianlite-client/pom.xml | 33 +------- .../java/org/apache/dubbo/benchmark/Client.java | 95 ---------------------- dubbo-hessianlite-server/pom.xml | 50 +----------- dubbo-kryo-client/pom.xml | 30 +------ .../src/main/resources/benchmark.properties | 2 - dubbo-kryo-client/src/main/resources/consumer.xml | 2 +- dubbo-kryo-server/pom.xml | 56 +------------ .../java/org/apache/dubbo/benchmark/Server.java | 14 ---- .../src/main/resources/benchmark.properties | 2 - pom.xml | 49 +++++++++++ server-base/pom.xml | 41 ++++++++++ .../java/org/apache/dubbo/benchmark/Server.java | 0 .../src/main/resources/benchmark.properties | 0 .../src/main/resources/logback.xml | 4 +- 26 files changed, 205 insertions(+), 363 deletions(-) diff --git a/.gitignore b/.gitignore index 2d74208..82665a0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ target/ # Log file *.log +logs/ # BlueJ files *.ctxt @@ -29,3 +30,6 @@ hs_err_pid* # preflight record result *.jfr + +# jmh output +*.json diff --git a/benchmark.sh b/benchmark.sh index 90c9fe4..0a015fe 100755 --- a/benchmark.sh +++ b/benchmark.sh @@ -5,7 +5,7 @@ usage() { } build() { - mvn -Dserver.host=${SERVER} -Dserver.port=${PORT} --projects benchmark-base,${PROJECT_DIR} clean package + mvn --projects benchmark-base,client-base,server-base,${PROJECT_DIR} clean package } java_options() { @@ -24,7 +24,7 @@ run() { JAR=`find ${PROJECT_DIR}/target/*.jar | head -n 1` echo echo "RUN ${PROJECT_DIR} IN ${MODE:-benchmark} MODE" - CMD="java ${JAVA_OPTIONS} -jar ${JAR}" + CMD="java ${JAVA_OPTIONS} -Dserver.host=${SERVER} -Dserver.port=${PORT} -jar ${JAR}" echo "command is: ${CMD}" echo ${CMD} diff --git a/client-base/pom.xml b/client-base/pom.xml new file mode 100644 index 0000000..3f279f1 --- /dev/null +++ b/client-base/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>client-base</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>benchmark-base</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>dubbo</artifactId> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-core</artifactId> + </dependency> + + <dependency> + <groupId>org.openjdk.jmh</groupId> + <artifactId>jmh-generator-annprocess</artifactId> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/client-base/src/main/java/org/apache/dubbo/Client.java b/client-base/src/main/java/org/apache/dubbo/Client.java new file mode 100644 index 0000000..c2f81f7 --- /dev/null +++ b/client-base/src/main/java/org/apache/dubbo/Client.java @@ -0,0 +1,15 @@ +package org.apache.dubbo; + +import org.apache.dubbo.benchmark.bean.User; +import org.apache.dubbo.benchmark.service.UserService; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Client { + public static void main(String[] args) { + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml"); + context.start(); + UserService userService = (UserService) context.getBean("userService"); + User user = userService.getUser(1); + System.out.println("user: " + user); + } +} diff --git a/dubbo-kryo-client/src/main/java/org/apache/dubbo/benchmark/Client.java b/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java similarity index 98% rename from dubbo-kryo-client/src/main/java/org/apache/dubbo/benchmark/Client.java rename to client-base/src/main/java/org/apache/dubbo/benchmark/Client.java index 08fe221..e6f9051 100644 --- a/dubbo-kryo-client/src/main/java/org/apache/dubbo/benchmark/Client.java +++ b/client-base/src/main/java/org/apache/dubbo/benchmark/Client.java @@ -86,7 +86,7 @@ public class Client extends AbstractClient { .measurementIterations(3) .measurementTime(TimeValue.seconds(10)) .threads(CONCURRENCY) - .resultFormat(ResultFormatType.JSON) +// .resultFormat(ResultFormatType.JSON) .forks(1) .build(); diff --git a/dubbo-hessianlite-client/src/main/resources/benchmark.properties b/client-base/src/main/resources/benchmark.properties similarity index 100% rename from dubbo-hessianlite-client/src/main/resources/benchmark.properties rename to client-base/src/main/resources/benchmark.properties diff --git a/dubbo-hessianlite-server/src/main/resources/logback.xml b/client-base/src/main/resources/logback.xml similarity index 76% rename from dubbo-hessianlite-server/src/main/resources/logback.xml rename to client-base/src/main/resources/logback.xml index 033bde0..202a8f4 100644 --- a/dubbo-hessianlite-server/src/main/resources/logback.xml +++ b/client-base/src/main/resources/logback.xml @@ -10,17 +10,17 @@ </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>logs/dubbo-hessianlite-server.log</file> + <file>logs/client-benchmark.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>logs/dubbo-hessianlite-server.%d{yyyy-MM-dd}.log.gz</fileNamePattern> + <fileNamePattern>logs/client-benchmark.%d{yyyy-MM-dd}.log.gz</fileNamePattern> </rollingPolicy> <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> <root level="INFO"> - <appender-ref ref="CONSOLE"/> + <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE"/> </root> </configuration> diff --git a/dubbo-hessianlite-client/pom.xml b/dubbo-fst-client/pom.xml similarity index 53% copy from dubbo-hessianlite-client/pom.xml copy to dubbo-fst-client/pom.xml index fd24a64..d00e9a8 100644 --- a/dubbo-hessianlite-client/pom.xml +++ b/dubbo-fst-client/pom.xml @@ -9,23 +9,17 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>dubbo-hessianlite-client</artifactId> - + <artifactId>dubbo-fst-client</artifactId> <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>client-base</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> + <groupId>de.ruedigermoeller</groupId> + <artifactId>fst</artifactId> </dependency> </dependencies> @@ -34,32 +28,16 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> + <inherited>true</inherited> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> + <inherited>true</inherited> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> <mainClass>org.apache.dubbo.benchmark.Client</mainClass> </manifest> </archive> @@ -67,7 +45,4 @@ </plugin> </plugins> </build> - - - </project> \ No newline at end of file diff --git a/dubbo-kryo-client/src/main/resources/consumer.xml b/dubbo-fst-client/src/main/resources/consumer.xml similarity index 63% copy from dubbo-kryo-client/src/main/resources/consumer.xml copy to dubbo-fst-client/src/main/resources/consumer.xml index e87fbda..59fd942 100644 --- a/dubbo-kryo-client/src/main/resources/consumer.xml +++ b/dubbo-fst-client/src/main/resources/consumer.xml @@ -4,9 +4,13 @@ xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/> - <dubbo:application name="dubbo-kyro-client"/> + <dubbo:application name="dubbo-fst-client"/> + <!-- FIXME: need to investigate why serialization optimizer doesn't work --> + <!--<dubbo:reference id="userService" check="false"--> + <!--interface="org.apache.dubbo.benchmark.service.UserService"--> + <!--url="dubbo://${server.host}:${server.port}?optimizer=org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl&serialization=fst"/>--> <dubbo:reference id="userService" check="false" interface="org.apache.dubbo.benchmark.service.UserService" - url="dubbo://localhost:8080?optimizer=org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl&serialization=kryo"/> + url="dubbo://${server.host}:${server.port}?serialization=fst"/> <dubbo:consumer client="netty4" filter="-default"/> </beans> \ No newline at end of file diff --git a/dubbo-kryo-server/src/main/resources/logback.xml b/dubbo-fst-client/src/main/resources/logback.xml similarity index 74% copy from dubbo-kryo-server/src/main/resources/logback.xml copy to dubbo-fst-client/src/main/resources/logback.xml index 6b20820..a9b8f56 100644 --- a/dubbo-kryo-server/src/main/resources/logback.xml +++ b/dubbo-fst-client/src/main/resources/logback.xml @@ -10,17 +10,17 @@ </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>logs/dubbo-kryo-server.log</file> + <file>logs/dubbo-fst-client.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>logs/dubbo-kryo-server.%d{yyyy-MM-dd}.log.gz</fileNamePattern> + <fileNamePattern>logs/dubbo-fst-client.%d{yyyy-MM-dd}.log.gz</fileNamePattern> </rollingPolicy> <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> - <root level="INFO"> - <appender-ref ref="CONSOLE"/> + <root level="DEBUG"> + <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE"/> </root> </configuration> diff --git a/dubbo-hessianlite-client/pom.xml b/dubbo-fst-server/pom.xml similarity index 52% copy from dubbo-hessianlite-client/pom.xml copy to dubbo-fst-server/pom.xml index fd24a64..ee45cfa 100644 --- a/dubbo-hessianlite-client/pom.xml +++ b/dubbo-fst-server/pom.xml @@ -9,23 +9,17 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>dubbo-hessianlite-client</artifactId> - + <artifactId>dubbo-fst-server</artifactId> <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>server-base</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> + <groupId>de.ruedigermoeller</groupId> + <artifactId>fst</artifactId> </dependency> </dependencies> @@ -34,40 +28,19 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> - <mainClass>org.apache.dubbo.benchmark.Client</mainClass> + <mainClass>org.apache.dubbo.benchmark.Server</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> - - - </project> \ No newline at end of file diff --git a/dubbo-kryo-client/src/main/resources/consumer.xml b/dubbo-fst-server/src/main/resources/provider.xml similarity index 50% copy from dubbo-kryo-client/src/main/resources/consumer.xml copy to dubbo-fst-server/src/main/resources/provider.xml index e87fbda..df2df05 100644 --- a/dubbo-kryo-client/src/main/resources/consumer.xml +++ b/dubbo-fst-server/src/main/resources/provider.xml @@ -4,9 +4,13 @@ xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/> - <dubbo:application name="dubbo-kyro-client"/> - <dubbo:reference id="userService" check="false" - interface="org.apache.dubbo.benchmark.service.UserService" - url="dubbo://localhost:8080?optimizer=org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl&serialization=kryo"/> - <dubbo:consumer client="netty4" filter="-default"/> + <dubbo:application name="dubbo-fst-server"/> + + <!-- FIXME: need to investigate why serialization optimizer doesn't work --> + <!--<dubbo:protocol name="dubbo" host="${server.host}" server="netty4" port="${server.port}" serialization="fst"--> + <!--optimizer="org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl"/>--> + <dubbo:protocol name="dubbo" host="${server.host}" server="netty4" port="${server.port}" serialization="fst"/> + <dubbo:registry address="N/A"/> + <dubbo:service interface="org.apache.dubbo.benchmark.service.UserService" ref="userService" filter="-default"/> + <bean id="userService" class="org.apache.dubbo.benchmark.service.UserServiceServerImpl"/> </beans> \ No newline at end of file diff --git a/dubbo-hessianlite-client/pom.xml b/dubbo-hessianlite-client/pom.xml index fd24a64..03f40ee 100644 --- a/dubbo-hessianlite-client/pom.xml +++ b/dubbo-hessianlite-client/pom.xml @@ -14,19 +14,9 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>client-base</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> - </dependency> </dependencies> <build> @@ -34,32 +24,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> <mainClass>org.apache.dubbo.benchmark.Client</mainClass> </manifest> </archive> @@ -67,7 +39,4 @@ </plugin> </plugins> </build> - - - </project> \ No newline at end of file diff --git a/dubbo-hessianlite-client/src/main/java/org/apache/dubbo/benchmark/Client.java b/dubbo-hessianlite-client/src/main/java/org/apache/dubbo/benchmark/Client.java deleted file mode 100644 index 08fe221..0000000 --- a/dubbo-hessianlite-client/src/main/java/org/apache/dubbo/benchmark/Client.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.apache.dubbo.benchmark; - -import com.alibaba.dubbo.config.ProtocolConfig; -import org.apache.dubbo.benchmark.bean.Page; -import org.apache.dubbo.benchmark.bean.User; -import org.apache.dubbo.benchmark.rpc.AbstractClient; -import org.apache.dubbo.benchmark.service.UserService; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; -import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.annotations.TearDown; -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 org.openjdk.jmh.runner.options.TimeValue; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -@State(Scope.Benchmark) -public class Client extends AbstractClient { - private static final int CONCURRENCY = 32; - - private final ClassPathXmlApplicationContext context; - private final UserService userService; - - public Client() { - context = new ClassPathXmlApplicationContext("consumer.xml"); - context.start(); - userService = (UserService) context.getBean("userService"); - } - - @Override - protected UserService getUserService() { - return userService; - } - - @TearDown - public void close() throws IOException { - context.close(); - ProtocolConfig.destroyAll(); - } - - @Benchmark - @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime}) - @OutputTimeUnit(TimeUnit.MILLISECONDS) - @Override - public boolean existUser() throws Exception { - return super.existUser(); - } - - @Benchmark - @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime}) - @OutputTimeUnit(TimeUnit.MILLISECONDS) - @Override - public boolean createUser() throws Exception { - return super.createUser(); - } - - @Benchmark - @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime}) - @OutputTimeUnit(TimeUnit.MILLISECONDS) - @Override - public User getUser() throws Exception { - return super.getUser(); - } - - @Benchmark - @BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime}) - @OutputTimeUnit(TimeUnit.MILLISECONDS) - @Override - public Page<User> listUser() throws Exception { - return super.listUser(); - } - - public static void main(String[] args) throws Exception { - Options opt = new OptionsBuilder() - .include(Client.class.getSimpleName()) - .warmupIterations(3) - .warmupTime(TimeValue.seconds(10)) - .measurementIterations(3) - .measurementTime(TimeValue.seconds(10)) - .threads(CONCURRENCY) - .resultFormat(ResultFormatType.JSON) - .forks(1) - .build(); - - new Runner(opt).run(); - } -} diff --git a/dubbo-hessianlite-server/pom.xml b/dubbo-hessianlite-server/pom.xml index 3cf144a..7955249 100644 --- a/dubbo-hessianlite-server/pom.xml +++ b/dubbo-hessianlite-server/pom.xml @@ -14,39 +14,9 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>server-base</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>dubbo</artifactId> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </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>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </dependency> </dependencies> <build> @@ -54,32 +24,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> <mainClass>org.apache.dubbo.benchmark.Server</mainClass> </manifest> </archive> diff --git a/dubbo-kryo-client/pom.xml b/dubbo-kryo-client/pom.xml index 4c1e8e8..cb62297 100644 --- a/dubbo-kryo-client/pom.xml +++ b/dubbo-kryo-client/pom.xml @@ -14,7 +14,7 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>client-base</artifactId> <version>${project.version}</version> </dependency> @@ -27,16 +27,6 @@ <groupId>com.esotericsoftware</groupId> <artifactId>kryo</artifactId> </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-core</artifactId> - </dependency> - - <dependency> - <groupId>org.openjdk.jmh</groupId> - <artifactId>jmh-generator-annprocess</artifactId> - </dependency> </dependencies> <build> @@ -44,32 +34,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> <mainClass>org.apache.dubbo.benchmark.Client</mainClass> </manifest> </archive> diff --git a/dubbo-kryo-client/src/main/resources/benchmark.properties b/dubbo-kryo-client/src/main/resources/benchmark.properties deleted file mode 100644 index 9d276bf..0000000 --- a/dubbo-kryo-client/src/main/resources/benchmark.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.host=localhost -server.port=8080 \ No newline at end of file diff --git a/dubbo-kryo-client/src/main/resources/consumer.xml b/dubbo-kryo-client/src/main/resources/consumer.xml index e87fbda..78cfd28 100644 --- a/dubbo-kryo-client/src/main/resources/consumer.xml +++ b/dubbo-kryo-client/src/main/resources/consumer.xml @@ -7,6 +7,6 @@ <dubbo:application name="dubbo-kyro-client"/> <dubbo:reference id="userService" check="false" interface="org.apache.dubbo.benchmark.service.UserService" - url="dubbo://localhost:8080?optimizer=org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl&serialization=kryo"/> + url="dubbo://${server.host}:${server.port}?optimizer=org.apache.dubbo.benchmark.serialize.SerializationOptimizerImpl&serialization=kryo"/> <dubbo:consumer client="netty4" filter="-default"/> </beans> \ No newline at end of file diff --git a/dubbo-kryo-server/pom.xml b/dubbo-kryo-server/pom.xml index 44415ee..67f2f1a 100644 --- a/dubbo-kryo-server/pom.xml +++ b/dubbo-kryo-server/pom.xml @@ -14,50 +14,14 @@ <dependencies> <dependency> <groupId>org.apache.dubbo</groupId> - <artifactId>benchmark-base</artifactId> + <artifactId>server-base</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>dubbo</artifactId> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </dependency> - <dependency> <groupId>de.javakaffee</groupId> <artifactId>kryo-serializers</artifactId> </dependency> - - <dependency> - <groupId>com.esotericsoftware</groupId> - <artifactId>kryo</artifactId> - <version>${kryo.version}</version> - </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>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </dependency> </dependencies> <build> @@ -65,32 +29,14 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory> - ${project.build.directory}/libs - </outputDirectory> - </configuration> - </execution> - </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.1.0</version> <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>libs/</classpathPrefix> <mainClass>org.apache.dubbo.benchmark.Server</mainClass> </manifest> </archive> diff --git a/dubbo-kryo-server/src/main/java/org/apache/dubbo/benchmark/Server.java b/dubbo-kryo-server/src/main/java/org/apache/dubbo/benchmark/Server.java deleted file mode 100644 index 6787d36..0000000 --- a/dubbo-kryo-server/src/main/java/org/apache/dubbo/benchmark/Server.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.apache.dubbo.benchmark; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class Server { - - public static void main(String[] args) throws InterruptedException { - try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("provider.xml")) { - context.start(); - Thread.sleep(Integer.MAX_VALUE); - } - } - -} diff --git a/dubbo-kryo-server/src/main/resources/benchmark.properties b/dubbo-kryo-server/src/main/resources/benchmark.properties deleted file mode 100644 index 9d276bf..0000000 --- a/dubbo-kryo-server/src/main/resources/benchmark.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.host=localhost -server.port=8080 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4f37b2d..bd9695d 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ <netty.version>4.1.25.Final</netty.version> <kryo.version>4.0.2</kryo.version> <kryo-serializers.version>0.42</kryo-serializers.version> + <fst.version>2.48-jdk-6</fst.version> <jmh.version>1.21</jmh.version> <slf4j.version>1.7.25</slf4j.version> <logback.version>1.2.3</logback.version> @@ -24,10 +25,14 @@ <modules> <module>benchmark-base</module> + <module>client-base</module> <module>dubbo-kryo-client</module> <module>dubbo-kryo-server</module> <module>dubbo-hessianlite-client</module> <module>dubbo-hessianlite-server</module> + <module>dubbo-fst-client</module> + <module>dubbo-fst-server</module> + <module>server-base</module> </modules> <dependencies> @@ -85,6 +90,12 @@ <version>${kryo.version}</version> </dependency> + <dependency> + <groupId>de.ruedigermoeller</groupId> + <artifactId>fst</artifactId> + <version>${fst.version}</version> + </dependency> + <dependency> <groupId>org.openjdk.jmh</groupId> <artifactId>jmh-core</artifactId> @@ -119,6 +130,44 @@ </dependencyManagement> <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory> + ${project.build.directory}/libs + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>libs/</classpathPrefix> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + + </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/server-base/pom.xml b/server-base/pom.xml new file mode 100644 index 0000000..2a11cf2 --- /dev/null +++ b/server-base/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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-benchmark</artifactId> + <groupId>org.apache.dubbo</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>server-base</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>benchmark-base</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>dubbo</artifactId> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/dubbo-hessianlite-server/src/main/java/org/apache/dubbo/benchmark/Server.java b/server-base/src/main/java/org/apache/dubbo/benchmark/Server.java similarity index 100% rename from dubbo-hessianlite-server/src/main/java/org/apache/dubbo/benchmark/Server.java rename to server-base/src/main/java/org/apache/dubbo/benchmark/Server.java diff --git a/dubbo-hessianlite-server/src/main/resources/benchmark.properties b/server-base/src/main/resources/benchmark.properties similarity index 100% rename from dubbo-hessianlite-server/src/main/resources/benchmark.properties rename to server-base/src/main/resources/benchmark.properties diff --git a/dubbo-kryo-server/src/main/resources/logback.xml b/server-base/src/main/resources/logback.xml similarity index 84% rename from dubbo-kryo-server/src/main/resources/logback.xml rename to server-base/src/main/resources/logback.xml index 6b20820..12b8926 100644 --- a/dubbo-kryo-server/src/main/resources/logback.xml +++ b/server-base/src/main/resources/logback.xml @@ -10,9 +10,9 @@ </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>logs/dubbo-kryo-server.log</file> + <file>logs/server-benchmark.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>logs/dubbo-kryo-server.%d{yyyy-MM-dd}.log.gz</fileNamePattern> + <fileNamePattern>logs/server-benchmark.%d{yyyy-MM-dd}.log.gz</fileNamePattern> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
