Skip to content
Permalink
Browse files
add fst support, simplify project structure
  • Loading branch information
beiwei30 committed May 24, 2018
1 parent 3b8c20b commit 1f21438105c964d15b5d202c1b405807539f154c
Showing 26 changed files with 326 additions and 288 deletions.
@@ -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
@@ -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}
@@ -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>
@@ -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);
}
}
@@ -86,7 +86,7 @@ public static void main(String[] args) throws Exception {
.measurementIterations(3)
.measurementTime(TimeValue.seconds(10))
.threads(CONCURRENCY)
.resultFormat(ResultFormatType.JSON)
// .resultFormat(ResultFormatType.JSON)
.forks(1)
.build();

@@ -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>
@@ -0,0 +1,48 @@
<?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>dubbo-fst-client</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>client-base</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<inherited>true</inherited>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<archive>
<manifest>
<mainClass>org.apache.dubbo.benchmark.Client</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
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-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&amp;serialization=fst"/>-->
<dubbo:reference id="userService" check="false"
interface="org.apache.dubbo.benchmark.service.UserService"
url="dubbo://${server.host}:${server.port}?serialization=fst"/>
<dubbo:consumer client="netty4" filter="-default"/>
</beans>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<jmxConfigurator/>

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/dubbo-fst-client.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<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>
</encoder>
</appender>

<root level="DEBUG">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE"/>
</root>
</configuration>
@@ -0,0 +1,46 @@
<?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>dubbo-fst-server</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>server-base</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.apache.dubbo.benchmark.Server</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
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-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>
@@ -14,60 +14,29 @@
<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>
<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>
<mainClass>org.apache.dubbo.benchmark.Client</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>



</project>

0 comments on commit 1f21438

Please sign in to comment.