Forráskód Böngészése

[ci fw-only Java/t-io] modify t-io to tio-mvc (#3881)

* add test for t-io

* update README.md

* update README.md

* add t-io

* add t-io.dockerfile

* delete t-io test

* add t-io test once more

* update t-io to 3.0.2

* 去掉没用的代码

* delete some useless code

* Optimization parameters

* delete useless jar

* upadte t-io to 3.0.3

* t-io update to 3.0.4

* update t-io to 3.0.4

* update t-io to 3.0.4

* [ci fw-only Java/t-io] modify t-io to tio-mvc
tywo45 7 éve
szülő
commit
aec99be4f2

+ 1 - 1
frameworks/Java/t-io/README.md

@@ -10,7 +10,7 @@ These implementations use the t-io's controller.
 
 
 ## Versions
-3.0.3.v20180620-RELEASE (https://gitee.com/tywo45/t-io)
+3.0.4.v20180620-RELEASE (https://gitee.com/tywo45/t-io)
 
 ## Test URLs
 

+ 4 - 4
frameworks/Java/t-io/benchmark_config.json

@@ -1,12 +1,12 @@
 {
-  "framework": "t-io",
+  "framework": "tio-mvc",
   "tests": [{
     "default": {
       "json_url": "/json",
       "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Platform",
+      "classification": "Micro",
       "database": "None",
       "framework": "None",
       "language": "Java",
@@ -16,8 +16,8 @@
       "webserver": "None",
       "os": "Linux",
       "database_os": "Linux",
-      "display_name": "tio-http-server",
-      "notes": "tio-http-server",
+      "display_name": "tio-mvc",
+      "notes": "tio-mvc",
       "versus": "t-io"
     }
   }]

+ 61 - 31
frameworks/Java/t-io/pom.xml

@@ -8,13 +8,13 @@
 	<parent>
 		<groupId>org.t-io</groupId>
 		<artifactId>tio-http-parent</artifactId>
-    <version>3.0.3.v20180620-RELEASE</version>
+		<version>3.0.4.v20180620-RELEASE</version>
 	</parent>
-	
+
 	<properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <main.class>org.tio.http.server.benchmark.TioBenchmarkStarter</main.class>
-    </properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<main.class>org.tio.http.server.benchmark.TioBenchmarkStarter</main.class>
+	</properties>
 
 	<dependencies>
 
@@ -49,7 +49,7 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
-
+		
 		<!-- slf4j-logback绑定 -->
 		<dependency>
 			<groupId>ch.qos.logback</groupId>
@@ -76,33 +76,63 @@
 			<groupId>org.slf4j</groupId>
 			<artifactId>log4j-over-slf4j</artifactId>
 		</dependency>
+
 	</dependencies>
 
 	<build>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <mainClass>${main.class}</mainClass>
-                        </manifest>
-                    </archive>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
-                        <phase>package</phase> <!-- bind to the packaging phase -->
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>false</filtering>
+			</resource>
+		</resources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<configuration>
+					<archive>
+						<manifest>
+							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+							<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+						</manifest>
+						<addMavenDescriptor>false</addMavenDescriptor><!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
+					</archive>
+
+					<finalName>${project.artifactId}</finalName>
+
+					<excludes>
+						<exclude>config/**/*</exclude>
+						<exclude>*.properties</exclude>
+						<exclude>*.xml</exclude>
+					</excludes>
+				</configuration>
+			</plugin>
+
+			<!-- The configuration of maven-assembly-plugin -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>make-assembly</id> <!--名字任意 -->
+						<phase>package</phase>  <!-- 绑定到package生命周期阶段上 -->
+						<goals>
+							<goal>single</goal>
+						</goals>
+						<configuration>
+							<appendAssemblyId>false</appendAssemblyId>
+							<descriptors>
+								<descriptor>script/pkg.xml</descriptor>
+							</descriptors>
+							<outputDirectory>${project.build.directory}/</outputDirectory>
+							<finalName>${project.artifactId}</finalName>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 
 </project>

+ 37 - 0
frameworks/Java/t-io/script/pkg.xml

@@ -0,0 +1,37 @@
+<assembly>
+	<!-- http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -->
+	<id>dist</id>
+	<formats>
+		<!-- zip,tar.gz,tar.bz2,jar,dir,war -->
+		<format>dir</format>
+	</formats>
+	
+	<includeBaseDirectory>false</includeBaseDirectory>
+  
+	<fileSets> 
+		
+		<!-- 把项目的配置文件放config目录 -->
+		<fileSet>
+			<directory>${project.basedir}/src/main/resources</directory>
+			<outputDirectory>config</outputDirectory>
+		</fileSet>
+        
+		<fileSet>
+			<directory>${project.basedir}</directory>
+			<outputDirectory></outputDirectory>
+			<includes>
+				<include>startup.*</include>
+				<include>debug.*</include>
+				<include>_cmd.*</include>
+			</includes>
+		</fileSet>
+	</fileSets>
+	
+
+	
+	<dependencySets>
+		<dependencySet>
+			<outputDirectory>lib</outputDirectory>			
+		</dependencySet>
+	</dependencySets>
+</assembly>

+ 4 - 1
frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/init/HttpServerInit.java

@@ -36,7 +36,10 @@ public class HttpServerInit {
 		httpServerStarter = new HttpServerStarter(httpConfig, requestHandler);
 		serverGroupContext = httpServerStarter.getServerGroupContext();
 		serverGroupContext.setReadBufferSize(TcpConst.MAX_DATA_LENGTH);
-		serverGroupContext.setPacketHandlerMode(PacketHandlerMode.QUEUE);
+		String mode = System.getProperty("packet.handler.mode");
+		if ("queue".equalsIgnoreCase(mode)) {
+			serverGroupContext.setPacketHandlerMode(PacketHandlerMode.QUEUE);
+		}
 		httpServerStarter.start();
 	}
 }

+ 12 - 0
frameworks/Java/t-io/startup.bat

@@ -0,0 +1,12 @@
+rem -Xms64m -Xmx2048m
+
+@echo off
+setlocal & pushd
+set APP_ENTRY=org.tio.http.server.benchmark.TioBenchmarkStarter
+set BASE=%~dp0
+set CP=%BASE%\config;%BASE%\lib\*
+java -server -Xverify:none -Xms1G -Xmx1G -Dpacket.handler.mode=queue -cp "%CP%" %APP_ENTRY%
+endlocal & popd
+
+
+

+ 12 - 0
frameworks/Java/t-io/startup.sh

@@ -0,0 +1,12 @@
+rem -Xms64m -Xmx2048m
+
+@echo off
+setlocal & pushd
+set APP_ENTRY=org.tio.http.server.benchmark.TioBenchmarkStarter
+set BASE=%~dp0
+set CP=%BASE%\config:%BASE%\lib\*
+java -server -Xverify:none -Xms1G -Xmx1G -Dpacket.handler.mode=queue -cp "%CP%" %APP_ENTRY%
+endlocal & popd
+
+
+

+ 0 - 10
frameworks/Java/t-io/t-io.dockerfile

@@ -1,10 +0,0 @@
-FROM maven:3.5.3-jdk-10-slim as maven
-WORKDIR /t-io
-COPY pom.xml pom.xml
-COPY src src
-RUN mvn compile assembly:single -q
-
-FROM openjdk:10-jre-slim
-WORKDIR /t-io
-COPY --from=maven /t-io/target/tio-http-server-benchmark-3.0.3.v20180620-RELEASE.jar app.jar
-CMD ["java", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-jar", "app.jar"]

+ 8 - 0
frameworks/Java/t-io/tio-mvc.dockerfile

@@ -0,0 +1,8 @@
+FROM maven:3.5.3-jdk-8
+WORKDIR /t-io
+COPY pom.xml pom.xml
+COPY src src
+COPY script script
+RUN mvn package -q
+WORKDIR /t-io/target/tio-http-server-benchmark
+CMD ["java", "-server", "-Xms1G", "-Xmx1G", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-Dpacket.handler.mode=queue1", "-cp", "/t-io/target/tio-http-server-benchmark/config:/t-io/target/tio-http-server-benchmark/lib/*", "org.tio.http.server.benchmark.TioBenchmarkStarter"]