diff --git a/frameworks/Java/t-io/README.md b/frameworks/Java/t-io/README.md index 8925afb67fb..e697e404032 100644 --- a/frameworks/Java/t-io/README.md +++ b/frameworks/Java/t-io/README.md @@ -10,7 +10,8 @@ These implementations use the t-io's controller. ## Versions -3.5.5.v20191010-RELEASE (https://gitee.com/tywo45/t-io) +* [Java OpenJDK 17](http://openjdk.java.net/) +* [t-io 3.8.6.v20240801-RELEASE](https://github.com/tywo45/t-io) ## Test URLs diff --git a/frameworks/Java/t-io/pom.xml b/frameworks/Java/t-io/pom.xml index 39eaaf6511f..6b1ac37317f 100644 --- a/frameworks/Java/t-io/pom.xml +++ b/frameworks/Java/t-io/pom.xml @@ -8,10 +8,11 @@ org.t-io tio-http-parent - 3.5.5.v20191010-RELEASE + 3.8.6.v20240801-RELEASE + 17 UTF-8 11 11 diff --git a/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/TioBenchmarkStarter.java b/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/TioBenchmarkStarter.java index b49613bbe80..8f1c7af2d9d 100644 --- a/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/TioBenchmarkStarter.java +++ b/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/TioBenchmarkStarter.java @@ -2,12 +2,13 @@ import java.io.IOException; +import org.tio.core.PacketHandlerMode; import org.tio.http.common.HttpConfig; import org.tio.http.server.HttpServerStarter; import org.tio.http.server.benchmark.controller.TestController; import org.tio.http.server.handler.DefaultHttpRequestHandler; import org.tio.http.server.mvc.Routes; -import org.tio.server.ServerTioConfig; +import org.tio.server.TioServerConfig; /** * @author tanyaowu @@ -17,7 +18,7 @@ public class TioBenchmarkStarter { public static HttpConfig httpConfig; public static DefaultHttpRequestHandler requestHandler; public static HttpServerStarter httpServerStarter; - public static ServerTioConfig serverTioConfig; + public static TioServerConfig tioServerConfig; /** * @param args @@ -36,8 +37,11 @@ public static void main(String[] args) throws Exception { requestHandler = new DefaultHttpRequestHandler(httpConfig, routes); requestHandler.setCompatibilityAssignment(false); httpServerStarter = new HttpServerStarter(httpConfig, requestHandler); - serverTioConfig = httpServerStarter.getServerTioConfig(); - serverTioConfig.statOn = false; + tioServerConfig = httpServerStarter.getTioServerConfig(); + tioServerConfig.setUseQueueDecode(false); + tioServerConfig.setPacketHandlerMode(PacketHandlerMode.SINGLE_THREAD); + tioServerConfig.setUseQueueSend(false); + tioServerConfig.statOn = false; httpServerStarter.start(); } } diff --git a/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/controller/TestController.java b/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/controller/TestController.java index 8066ee86b49..f9590d3b1d8 100644 --- a/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/controller/TestController.java +++ b/frameworks/Java/t-io/src/main/java/org/tio/http/server/benchmark/controller/TestController.java @@ -20,12 +20,14 @@ public class TestController { private static final String HELLO_WORLD = "Hello, World!"; private static final byte[] HELLO_WORLD_BYTES = HELLO_WORLD.getBytes(); + + private static final Message MESSAGE = new Message(HELLO_WORLD); @RequestPath(value = "json") public HttpResponse json(HttpRequest request) throws Exception { //更高性能的写法 HttpResponse ret = new HttpResponse(request); - ret.setBody(Json.toJson(new Message(HELLO_WORLD)).getBytes()); + ret.setBody(Json.toJson(MESSAGE).getBytes()); ret.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); return ret; diff --git a/frameworks/Java/t-io/tio-mvc.dockerfile b/frameworks/Java/t-io/tio-mvc.dockerfile index 5f99958b62a..1ed34913eed 100644 --- a/frameworks/Java/t-io/tio-mvc.dockerfile +++ b/frameworks/Java/t-io/tio-mvc.dockerfile @@ -5,7 +5,7 @@ COPY src src COPY script script RUN mvn package -q -#TODO use separate JDK/JRE for the RUN (as the other builds) +FROM openjdk:17 WORKDIR /t-io/target/tio-http-server-benchmark EXPOSE 8080