Skip to content

Commit 9e77bf9

Browse files
author
litongjava
committed
add aio-socket
1 parent a0ebdee commit 9e77bf9

File tree

16 files changed

+600
-0
lines changed

16 files changed

+600
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.github
2+
.git
3+
.DS_Store
4+
docs
5+
kubernetes
6+
node_modules
7+
/.svelte-kit
8+
/package
9+
.env
10+
.env.*
11+
vite.config.js.timestamp-*
12+
vite.config.ts.timestamp-*
13+
__pycache__
14+
.env
15+
_old
16+
uploads
17+
.ipynb_checkpoints
18+
**/*.db
19+
_test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target/
2+
logs
3+
.settings
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# t-io Benchmarking Test
2+
3+
This is the tio-server portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
4+
5+
## Controller
6+
7+
These implementations use the tio-server's controller.
8+
9+
### Plaintext Test
10+
11+
* [Plaintext test source](src/main/java/com/litongjava/tio/http/server/controller/IndexController.java)
12+
13+
### JSON Serialization Test
14+
15+
* [JSON test source](src/main/java/com/litongjava/tio/http/server/controller/IndexController.java)
16+
17+
18+
## Versions
19+
3.7.3.v20231218-RELEASE (https://gitee.com/litongjava/t-io)
20+
21+
## Test URLs
22+
23+
All implementations use the same URLs.
24+
25+
### Plaintext Test
26+
27+
http://localhost:8080/plaintext
28+
29+
### JSON Encoding Test
30+
31+
http://localhost:8080/json
32+
33+
34+
35+
## Hot to run
36+
### install mysql 8
37+
- 1.please instal mysql 8.0.32,example cmd
38+
```
39+
docker run --restart=always -d --name mysql_8 --hostname mysql \
40+
-p 3306:3306 \
41+
-e 'MYSQL_ROOT_PASSWORD=robot_123456#' -e 'MYSQL_ROOT_HOST=%' -e 'MYSQL_DATABASE=hello_world' \
42+
mysql/mysql-server:8.0.32 \
43+
--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1
44+
```
45+
- 2.create database schema hello_world
46+
- 3.create tablle,[example](sql/hello_world.sql)
47+
- 4.import data
48+
49+
### docker
50+
```
51+
docker build -t tio-server-benchmark -f tio-server.dockerfile .
52+
```
53+
The run is to specify the mysql database
54+
```
55+
docker run --rm -p 8080:8080 \
56+
-e JDBC_URL="jdbc:mysql://192.168.3.9/hello_world" \
57+
-e JDBC_USER="root" \
58+
-e JDBC_PSWD="robot_123456#" \
59+
tio-server-benchmark
60+
```
61+
62+
### windows
63+
64+
-windows
65+
```
66+
D:\java\jdk1.8.0_121\bin\java -jar target\tio-server-benchmark-1.0.jar --JDBC_URL=jdbc:mysql://192.168.3.9/hello_world?useSSL=false --JDBC_USER=root --JDBC_PSWD=robot_123456#
67+
```
68+
or
69+
```
70+
set JDBC_URL=jdbc:mysql://192.168.3.9/hello_world
71+
set jdbc.user=root
72+
set JDBC_PSWD=robot_123456#
73+
D:\java\jdk1.8.0_121\bin\java -jar target\tio-server-benchmark-1.0.jar
74+
```
75+
76+
77+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM litongjava/maven:3.8.8-jdk8u391 AS builder
2+
WORKDIR /app
3+
4+
COPY pom.xml pom.xml
5+
RUN mvn dependency:go-offline -q
6+
7+
COPY src src
8+
RUN mvn package -Passembly -q
9+
RUN ls -l && ls -l target
10+
11+
FROM litongjava/jre:8u391-stable-slim
12+
13+
WORKDIR /app
14+
15+
COPY --from=builder /app/target/aio-socket-benchmark-1.0-jar-with-dependencies.jar /app/aio-socket-benchmark-1.0.jar
16+
17+
EXPOSE 8080
18+
19+
CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC","-cp", "/app/aio-socket-benchmark-1.0.jar","com.litongjava.aio.http.server.HttpServer"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"framework": "aio-socket",
3+
"tests": [{
4+
"default": {
5+
"plaintext_url": "/plaintext",
6+
"json_url": "/json",
7+
"port": 8080,
8+
"approach": "Realistic",
9+
"classification": "Micro",
10+
"framework": "aio-socket",
11+
"language": "Java",
12+
"flavor": "None",
13+
"orm": "Raw",
14+
"platform": "t-io",
15+
"webserver": "None",
16+
"os": "Linux",
17+
"database_os": "Linux",
18+
"display_name": "aio-socket",
19+
"notes": "aio-socket",
20+
"versus": "t-io"
21+
}
22+
}]
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[framework]
2+
name = "t-io"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Micro"
9+
database = "None"
10+
database_os = "Linux"
11+
os = "Linux"
12+
orm = "Raw"
13+
platform = "t-io"
14+
webserver = "None"
15+
versus = "t-io"

frameworks/Java/aio-socket/pom.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<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">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.litongjava</groupId>
4+
<artifactId>aio-socket-benchmark</artifactId>
5+
<version>1.0</version>
6+
<name>${project.artifactId}</name>
7+
<properties>
8+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
9+
<java.version>1.8</java.version>
10+
<maven.compiler.source>${java.version}</maven.compiler.source>
11+
<maven.compiler.target>${java.version}</maven.compiler.target>
12+
<main.class>com.litongjava.aio.http.server.HttpServer</main.class>
13+
</properties>
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.litongjava</groupId>
17+
<artifactId>aio-socket</artifactId>
18+
<version>1.0.1</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.alibaba</groupId>
22+
<artifactId>fastjson</artifactId>
23+
<version>2.0.39</version>
24+
</dependency>
25+
26+
</dependencies>
27+
<repositories>
28+
<repository>
29+
<id>central</id>
30+
<name>Central Repository</name>
31+
<url>https://repo.maven.apache.org/maven2</url>
32+
</repository>
33+
<repository>
34+
<id>sonatype-nexus-snapshots</id>
35+
<name>Sonatype Nexus Snapshots</name>
36+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
37+
</repository>
38+
</repositories>
39+
<pluginRepositories>
40+
<pluginRepository>
41+
<id>central</id>
42+
<name>Central Repository</name>
43+
<url>https://repo.maven.apache.org/maven2</url>
44+
</pluginRepository>
45+
<pluginRepository>
46+
<id>sonatype-nexus-snapshots</id>
47+
<name>Sonatype Nexus Snapshots</name>
48+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
49+
<releases>
50+
<enabled>false</enabled>
51+
</releases>
52+
<snapshots>
53+
<enabled>true</enabled>
54+
</snapshots>
55+
</pluginRepository>
56+
</pluginRepositories>
57+
<build>
58+
<plugins>
59+
60+
<plugin>
61+
<inherited>true</inherited>
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-compiler-plugin</artifactId>
64+
<version>3.8.0</version>
65+
<configuration>
66+
<debug>false</debug>
67+
</configuration>
68+
</plugin>
69+
70+
<plugin>
71+
<artifactId>maven-assembly-plugin</artifactId>
72+
<version>3.1.0</version>
73+
<configuration>
74+
<descriptorRefs>
75+
<descriptorRef>jar-with-dependencies</descriptorRef>
76+
</descriptorRefs>
77+
</configuration>
78+
<executions>
79+
<execution>
80+
<id>make-assembly</id>
81+
<phase>package</phase>
82+
<goals>
83+
<goal>single</goal>
84+
</goals>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
</project>

0 commit comments

Comments
 (0)