Skip to content

Commit

Permalink
Tio server (#8659)
Browse files Browse the repository at this point in the history
* add tio-server

* add simple docker file

* fix docker file

* chage log level to info

* add template and activate record

* add cache

* update reupadme.md

* update cache query

* test on windows

* chage to EnviormentUtils

* add java run with jdb info

* add EnviormentUtils

* change to JDBC_URL

* add mysql run cmd

* update dockerfile add jdbc info

* fix jdbc info error

* fix  Unterminated quoted string on dockerfile

* fix jdb_user error

* add "database": "MySQL",

* chage in to Integer of Fortune

* add #escape to avoid xxs

* remove caffeine and add ehcache

* failed to test native

* change to cached_query_url

* add native arg

* remove unused file for tio-http-server

* add dockerignore

* update jar name to tio-http-server-benchmark

* update version

* fix all query

* update docker file

* update docker file and plugin

* update docker file

* update dockerfile

* update tio-http-server version

* remove native support

* update tio-http-server version

* update jdbc info

* update docker file

---------

Co-authored-by: litongjava <[email protected]>
  • Loading branch information
litongjava and litongjava authored Dec 25, 2024
1 parent 989d88d commit 0597580
Show file tree
Hide file tree
Showing 28 changed files with 1,293 additions and 0 deletions.
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
```



227 changes: 227 additions & 0 deletions frameworks/Java/tio-http-server/api/tio-server-benchmark.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
---
title: tio-server-benchmark v1.0.0
language_tabs:
- shell: Shell
- http: HTTP
- javascript: JavaScript
- ruby: Ruby
- python: Python
- php: PHP
- java: Java
- go: Go
toc_footers: []
includes: []
search: true
code_clipboard: true
highlight_theme: darkula
headingLevel: 2
generator: "@tarslib/widdershins v4.0.17"

---

# tio-server-benchmark

> v1.0.0
Base URLs:

# Authentication

# Default

## GET plaintext

GET /plaintext

> 返回示例
> 200 Response
```json
{}
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

## GET json

GET /json

> 返回示例
> 200 Response
```json
{}
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

## GET db

GET /db

### 请求参数

|名称|位置|类型|必选|说明|
|---|---|---|---|---|
|id|query|string||none|

> 返回示例
> 200 Response
```json
{
"id": 0,
"randomNumber": 0
}
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

状态码 **200**

|名称|类型|必选|约束|中文名|说明|
|---|---|---|---|---|---|
|» id|integer|true|none||none|
|» randomNumber|integer|true|none||none|

## GET updates

GET /updates

### 请求参数

|名称|位置|类型|必选|说明|
|---|---|---|---|---|
|queries|query|string||none|

> 返回示例
> 成功
```json
[
{
"id": 28,
"randomNumber": 5399,
"randomnumber": 1498
}
]
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

状态码 **200**

|名称|类型|必选|约束|中文名|说明|
|---|---|---|---|---|---|
|» id|integer|false|none||none|
|» randomNumber|integer|false|none||none|
|» randomnumber|integer|false|none||none|

## GET fortunes

GET /fortunes

> 返回示例
> 200 Response
```json
{}
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

## GET cacheQuery

GET /cacheQuery

### 请求参数

|名称|位置|类型|必选|说明|
|---|---|---|---|---|
|queries|query|string||none|

> 返回示例
> 200 Response
```json
[
{
"id": 0,
"randomNumber": 0
}
]
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

状态码 **200**

|名称|类型|必选|约束|中文名|说明|
|---|---|---|---|---|---|
|» id|integer|false|none||none|
|» randomNumber|integer|false|none||none|

## GET cacheList

GET /cacheList

> 返回示例
> 200 Response
```json
{}
```

### 返回结果

|状态码|状态码含义|说明|数据模型|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|

### 返回数据结构

# 数据模型

29 changes: 29 additions & 0 deletions frameworks/Java/tio-http-server/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"framework": "tio-server",
"tests": [{
"default": {
"plaintext_url": "/plaintext",
"json_url": "/json",
"db_url": "/db",
"query_url": "/queries?queries=",
"fortune_url": "/fortunes",
"update_url": "/updates?queries=",
"cached_query_url" : "/cachedQuery?queries=",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "MySQL",
"framework": "tio-server",
"language": "Java",
"flavor": "None",
"orm": "Raw",
"platform": "t-io",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "tio-server",
"notes": "tio-server",
"versus": "t-io"
}
}]
}
Loading

0 comments on commit 0597580

Please sign in to comment.