Skip to content

Commit 11621a4

Browse files
committed
2 parents 936f941 + 2ed435c commit 11621a4

File tree

78 files changed

+2360
-1006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2360
-1006
lines changed

frameworks/Java/smart-socket/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<maven.compiler.source>21</maven.compiler.source>
1212
<maven.compiler.target>21</maven.compiler.target>
1313
<log4j.version>2.17.1</log4j.version>
14-
<smartservlet.version>2.5</smartservlet.version>
14+
<smartservlet.version>2.7</smartservlet.version>
1515
<hikaricp.version>5.0.0</hikaricp.version>
1616
<jsoniter.version>0.9.23</jsoniter.version>
1717
</properties>

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
import com.zaxxer.hikari.HikariConfig;
1212
import com.zaxxer.hikari.HikariDataSource;
1313
import org.smartboot.Message;
14-
import org.smartboot.http.server.HttpBootstrap;
15-
import org.smartboot.http.server.HttpRequest;
16-
import org.smartboot.http.server.HttpResponse;
17-
import org.smartboot.http.server.HttpServerHandler;
18-
import org.smartboot.http.server.handler.HttpRouteHandler;
14+
import tech.smartboot.feat.core.server.HttpRequest;
15+
import tech.smartboot.feat.core.server.HttpResponse;
16+
import tech.smartboot.feat.core.server.HttpServer;
17+
import tech.smartboot.feat.core.server.HttpServerHandler;
18+
import tech.smartboot.feat.core.server.handler.HttpRouteHandler;
1919

2020
import javax.sql.DataSource;
2121

@@ -25,9 +25,9 @@ public class Bootstrap {
2525
public static void main(String[] args) {
2626
int cpuNum = Runtime.getRuntime().availableProcessors();
2727
// 定义服务器接受的消息类型以及各类消息对应的处理器
28-
HttpBootstrap bootstrap = new HttpBootstrap();
28+
HttpServer bootstrap = new HttpServer();
2929
bootstrap.configuration()
30-
.threadNum(cpuNum)
30+
.threadNum(cpuNum + 1)
3131
.headerLimiter(0)
3232
.readBufferSize(1024 * 4)
3333
.writeBufferSize(1024 * 4);

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/JsonUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.jsoniter.spi.JsonException;
66
import com.jsoniter.spi.Slice;
77
import jakarta.servlet.http.HttpServletResponse;
8-
import org.smartboot.http.server.HttpResponse;
8+
import tech.smartboot.feat.core.server.HttpResponse;
99

1010
import java.io.IOException;
1111

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package org.smartboot.http;
22

3-
import org.smartboot.http.common.utils.NumberUtils;
4-
import org.smartboot.http.server.HttpRequest;
5-
import org.smartboot.http.server.HttpResponse;
6-
import org.smartboot.http.server.HttpServerHandler;
3+
4+
import tech.smartboot.feat.core.common.utils.NumberUtils;
5+
import tech.smartboot.feat.core.server.HttpRequest;
6+
import tech.smartboot.feat.core.server.HttpResponse;
7+
import tech.smartboot.feat.core.server.HttpServerHandler;
78

89
import javax.sql.DataSource;
910
import java.io.IOException;

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package org.smartboot.http;
22

3-
import org.smartboot.http.server.HttpRequest;
4-
import org.smartboot.http.server.HttpResponse;
5-
import org.smartboot.http.server.HttpServerHandler;
3+
4+
import tech.smartboot.feat.core.server.HttpRequest;
5+
import tech.smartboot.feat.core.server.HttpResponse;
6+
import tech.smartboot.feat.core.server.HttpServerHandler;
67

78
import javax.sql.DataSource;
89
import java.io.IOException;

frameworks/Java/smart-socket/src/main/java/org/smartboot/http/UpdateHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package org.smartboot.http;
22

3-
import org.smartboot.http.common.utils.NumberUtils;
4-
import org.smartboot.http.server.HttpRequest;
5-
import org.smartboot.http.server.HttpResponse;
6-
import org.smartboot.http.server.HttpServerHandler;
3+
4+
import tech.smartboot.feat.core.common.utils.NumberUtils;
5+
import tech.smartboot.feat.core.server.HttpRequest;
6+
import tech.smartboot.feat.core.server.HttpResponse;
7+
import tech.smartboot.feat.core.server.HttpServerHandler;
78

89
import javax.sql.DataSource;
910
import java.io.IOException;

frameworks/Java/solon/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.noear</groupId>
77
<artifactId>solon-parent</artifactId>
8-
<version>3.0.4</version>
8+
<version>3.0.5</version>
99
</parent>
1010

1111
<groupId>hello</groupId>
@@ -21,7 +21,12 @@
2121
<dependencies>
2222
<dependency>
2323
<groupId>org.noear</groupId>
24-
<artifactId>solon-web</artifactId>
24+
<artifactId>solon-lib</artifactId>
25+
</dependency>
26+
27+
<dependency>
28+
<groupId>org.noear</groupId>
29+
<artifactId>solon-boot-smarthttp</artifactId>
2530
</dependency>
2631

2732
<dependency>
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: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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+
### Database Query Test
18+
19+
* [Database Query test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))
20+
21+
### Database Queries Test
22+
23+
* [Database Queries test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))
24+
25+
### Database Update Test
26+
27+
* [Database Update test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))
28+
29+
### Template rendering Test
30+
31+
* [Template rendering test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))
32+
33+
### Cache Query Test
34+
* [Cache query test source](src/main/java/com/litongjava/tio/http/server/controller/CacheController.java))
35+
36+
37+
## Versions
38+
3.7.3.v20231218-RELEASE (https://gitee.com/litongjava/t-io)
39+
40+
## Test URLs
41+
42+
All implementations use the same URLs.
43+
44+
### Plaintext Test
45+
46+
http://localhost:8080/plaintext
47+
48+
### JSON Encoding Test
49+
50+
http://localhost:8080/json
51+
52+
### Database Query Test
53+
54+
http://localhost:8080/db
55+
56+
### Database Queries Test
57+
58+
http://localhost:8080/queries?queries=5
59+
60+
### Cache Query Test
61+
62+
http://localhost:8080/cacheQuery?queries=10000
63+
64+
### Template rendering Test
65+
66+
http://localhost:8080/fortunes
67+
68+
### Database Update Test
69+
70+
http://localhost:8080/updates?queries=5
71+
72+
## Hot to run
73+
### install mysql 8
74+
- 1.please instal mysql 8.0.32,example cmd
75+
```
76+
docker run --restart=always -d --name mysql_8 --hostname mysql \
77+
-p 3306:3306 \
78+
-e 'MYSQL_ROOT_PASSWORD=robot_123456#' -e 'MYSQL_ROOT_HOST=%' -e 'MYSQL_DATABASE=hello_world' \
79+
mysql/mysql-server:8.0.32 \
80+
--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1
81+
```
82+
- 2.create database schema hello_world
83+
- 3.create tablle,[example](sql/hello_world.sql)
84+
- 4.import data
85+
86+
### docker
87+
```
88+
docker build -t tio-server-benchmark -f tio-server.dockerfile .
89+
```
90+
The run is to specify the mysql database
91+
```
92+
docker run --rm -p 8080:8080 \
93+
-e JDBC_URL="jdbc:mysql://192.168.3.9/hello_world" \
94+
-e JDBC_USER="root" \
95+
-e JDBC_PSWD="robot_123456#" \
96+
tio-server-benchmark
97+
```
98+
99+
### windows
100+
101+
-windows
102+
```
103+
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#
104+
```
105+
or
106+
```
107+
set JDBC_URL=jdbc:mysql://192.168.3.9/hello_world
108+
set jdbc.user=root
109+
set JDBC_PSWD=robot_123456#
110+
D:\java\jdk1.8.0_121\bin\java -jar target\tio-server-benchmark-1.0.jar
111+
```
112+
113+
114+

0 commit comments

Comments
 (0)