Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Dec 31, 2024
2 parents 936f941 + 2ed435c commit 11621a4
Show file tree
Hide file tree
Showing 78 changed files with 2,360 additions and 1,006 deletions.
2 changes: 1 addition & 1 deletion frameworks/Java/smart-socket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<log4j.version>2.17.1</log4j.version>
<smartservlet.version>2.5</smartservlet.version>
<smartservlet.version>2.7</smartservlet.version>
<hikaricp.version>5.0.0</hikaricp.version>
<jsoniter.version>0.9.23</jsoniter.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.smartboot.Message;
import org.smartboot.http.server.HttpBootstrap;
import org.smartboot.http.server.HttpRequest;
import org.smartboot.http.server.HttpResponse;
import org.smartboot.http.server.HttpServerHandler;
import org.smartboot.http.server.handler.HttpRouteHandler;
import tech.smartboot.feat.core.server.HttpRequest;
import tech.smartboot.feat.core.server.HttpResponse;
import tech.smartboot.feat.core.server.HttpServer;
import tech.smartboot.feat.core.server.HttpServerHandler;
import tech.smartboot.feat.core.server.handler.HttpRouteHandler;

import javax.sql.DataSource;

Expand All @@ -25,9 +25,9 @@ public class Bootstrap {
public static void main(String[] args) {
int cpuNum = Runtime.getRuntime().availableProcessors();
// 定义服务器接受的消息类型以及各类消息对应的处理器
HttpBootstrap bootstrap = new HttpBootstrap();
HttpServer bootstrap = new HttpServer();
bootstrap.configuration()
.threadNum(cpuNum)
.threadNum(cpuNum + 1)
.headerLimiter(0)
.readBufferSize(1024 * 4)
.writeBufferSize(1024 * 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.jsoniter.spi.JsonException;
import com.jsoniter.spi.Slice;
import jakarta.servlet.http.HttpServletResponse;
import org.smartboot.http.server.HttpResponse;
import tech.smartboot.feat.core.server.HttpResponse;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.smartboot.http;

import org.smartboot.http.common.utils.NumberUtils;
import org.smartboot.http.server.HttpRequest;
import org.smartboot.http.server.HttpResponse;
import org.smartboot.http.server.HttpServerHandler;

import tech.smartboot.feat.core.common.utils.NumberUtils;
import tech.smartboot.feat.core.server.HttpRequest;
import tech.smartboot.feat.core.server.HttpResponse;
import tech.smartboot.feat.core.server.HttpServerHandler;

import javax.sql.DataSource;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package org.smartboot.http;

import org.smartboot.http.server.HttpRequest;
import org.smartboot.http.server.HttpResponse;
import org.smartboot.http.server.HttpServerHandler;

import tech.smartboot.feat.core.server.HttpRequest;
import tech.smartboot.feat.core.server.HttpResponse;
import tech.smartboot.feat.core.server.HttpServerHandler;

import javax.sql.DataSource;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.smartboot.http;

import org.smartboot.http.common.utils.NumberUtils;
import org.smartboot.http.server.HttpRequest;
import org.smartboot.http.server.HttpResponse;
import org.smartboot.http.server.HttpServerHandler;

import tech.smartboot.feat.core.common.utils.NumberUtils;
import tech.smartboot.feat.core.server.HttpRequest;
import tech.smartboot.feat.core.server.HttpResponse;
import tech.smartboot.feat.core.server.HttpServerHandler;

import javax.sql.DataSource;
import java.io.IOException;
Expand Down
9 changes: 7 additions & 2 deletions frameworks/Java/solon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>solon-parent</artifactId>
<version>3.0.4</version>
<version>3.0.5</version>
</parent>

<groupId>hello</groupId>
Expand All @@ -21,7 +21,12 @@
<dependencies>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-web</artifactId>
<artifactId>solon-lib</artifactId>
</dependency>

<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-boot-smarthttp</artifactId>
</dependency>

<dependency>
Expand Down
19 changes: 19 additions & 0 deletions frameworks/Java/tio-http-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.github
.git
.DS_Store
docs
kubernetes
node_modules
/.svelte-kit
/package
.env
.env.*
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
__pycache__
.env
_old
uploads
.ipynb_checkpoints
**/*.db
_test
3 changes: 3 additions & 0 deletions frameworks/Java/tio-http-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target/
logs
.settings
114 changes: 114 additions & 0 deletions frameworks/Java/tio-http-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# t-io Benchmarking Test

This is the tio-server portion of a [benchmarking test suite](../) comparing a variety of web development platforms.

## Controller

These implementations use the tio-server's controller.

### Plaintext Test

* [Plaintext test source](src/main/java/com/litongjava/tio/http/server/controller/IndexController.java)

### JSON Serialization Test

* [JSON test source](src/main/java/com/litongjava/tio/http/server/controller/IndexController.java)

### Database Query Test

* [Database Query test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))

### Database Queries Test

* [Database Queries test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))

### Database Update Test

* [Database Update test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))

### Template rendering Test

* [Template rendering test source](src/main/java/com/litongjava/tio/http/server/controller/DbController.java))

### Cache Query Test
* [Cache query test source](src/main/java/com/litongjava/tio/http/server/controller/CacheController.java))


## Versions
3.7.3.v20231218-RELEASE (https://gitee.com/litongjava/t-io)

## Test URLs

All implementations use the same URLs.

### Plaintext Test

http://localhost:8080/plaintext

### JSON Encoding Test

http://localhost:8080/json

### Database Query Test

http://localhost:8080/db

### Database Queries Test

http://localhost:8080/queries?queries=5

### Cache Query Test

http://localhost:8080/cacheQuery?queries=10000

### Template rendering Test

http://localhost:8080/fortunes

### Database Update Test

http://localhost:8080/updates?queries=5

## Hot to run
### install mysql 8
- 1.please instal mysql 8.0.32,example cmd
```
docker run --restart=always -d --name mysql_8 --hostname mysql \
-p 3306:3306 \
-e 'MYSQL_ROOT_PASSWORD=robot_123456#' -e 'MYSQL_ROOT_HOST=%' -e 'MYSQL_DATABASE=hello_world' \
mysql/mysql-server:8.0.32 \
--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1
```
- 2.create database schema hello_world
- 3.create tablle,[example](sql/hello_world.sql)
- 4.import data

### docker
```
docker build -t tio-server-benchmark -f tio-server.dockerfile .
```
The run is to specify the mysql database
```
docker run --rm -p 8080:8080 \
-e JDBC_URL="jdbc:mysql://192.168.3.9/hello_world" \
-e JDBC_USER="root" \
-e JDBC_PSWD="robot_123456#" \
tio-server-benchmark
```

### windows

-windows
```
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#
```
or
```
set JDBC_URL=jdbc:mysql://192.168.3.9/hello_world
set jdbc.user=root
set JDBC_PSWD=robot_123456#
D:\java\jdk1.8.0_121\bin\java -jar target\tio-server-benchmark-1.0.jar
```



Loading

0 comments on commit 11621a4

Please sign in to comment.