Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frameworks/Java/t-io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions frameworks/Java/t-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
<parent>
<groupId>org.t-io</groupId>
<artifactId>tio-http-parent</artifactId>
<version>3.5.5.v20191010-RELEASE</version>
<version>3.8.6.v20240801-RELEASE</version>
</parent>

<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<main.class>org.tio.http.server.benchmark.TioBenchmarkStarter</main.class>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion frameworks/Java/t-io/startup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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%
java -server -Xverify:none -Xms1G -Xmx1G -cp "%CP%" %APP_ENTRY%
endlocal & popd


Expand Down
4 changes: 2 additions & 2 deletions frameworks/Java/t-io/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ rem -Xms64m -Xmx2048m
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%
set CP=%BASE%/config:%BASE%/lib/*
java -server -Xverify:none -Xms1G -Xmx4G -cp "%CP%" %APP_ENTRY%
endlocal & popd


Expand Down
4 changes: 2 additions & 2 deletions frameworks/Java/t-io/tio-mvc.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3.6.1-jdk-11-slim as maven
FROM maven:3.9.7-amazoncorretto-21 AS build
WORKDIR /t-io
COPY pom.xml pom.xml
COPY src src
Expand All @@ -10,4 +10,4 @@ WORKDIR /t-io/target/tio-http-server-benchmark

EXPOSE 8080

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"]
CMD ["java", "-server", "-Xms1G", "-Xmx4G", "-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"]
Loading