Compare commits

...

2 Commits

Author SHA1 Message Date
ef0464234a 📝 Update benchmark
All checks were successful
release-nightly / build-docker (push) Successful in 1m59s
2023-11-30 22:35:46 +08:00
9f9ccedbc7 Can disable request logging 2023-11-30 22:35:40 +08:00
7 changed files with 63 additions and 48 deletions

View File

@ -20,11 +20,13 @@ We use roadsign and nginx to host a same static file, and test them with [go-wrk
Here's the result:
| **Software** | Total Requests | Requests per Seconds | Transfer per Seconds | Avg Time | Fastest Time | Slowest Time | Errors Count |
|:---------------------:|----------------|:--------------------:|:--------------------:|:-----------:|:------------:|:------------:|:------------:|
| _Nginx_ | 515749 | 4299.58 | 2.05MB | 13.954846ms | 0s | 410.6972ms | 0 |
| _RoadSign_ | 3256820 | 27265.90 | 12.27MB | 2.20055ms | 0s | 56.8726ms | 0 |
| _RoadSign w/ Prefork_ | 2188594 | 18248.45 | 8.21MB | 3.287951ms | 0s | 121.5189ms | 0 |
|:---------------------:|:--------------:|:--------------------:|:--------------------:|:-----------:|:------------:|:------------:|:------------:|
| _Nginx_ | 515749 | 4299.58 | 2.05MB | 13.954846ms | 0s (Cached) | 410.6972ms | 0 |
| _RoadSign_ | 8905230 | 76626.70 | 30.98MB | 783.016µs | 28.542µs | 46.773083ms | 0 |
| _RoadSign w/ Prefork_ | 4784308 | 40170.41 | 16.24MB | 1.493636ms | 34.291µs | 8.727666ms | 0 |
As result, roadsign undoubtedly is the fastest one.
It can be found that the prefork feature makes RoadSign more stable in concurrency. We can see this from the **Slowest Time**. At the same time, the **Fastest Time** is affected because reusing ports requires some extra steps to handle load balancing. Enable this feature at your own discretion depending on your use case.
More details can be found at benchmark's [README.md](./test/benchmark/README.md)

View File

@ -21,10 +21,12 @@ func InitAdministration() *fiber.App {
TrustedProxies: viper.GetStringSlice("security.administration_trusted_proxies"),
})
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Administration] [${time}] ${status} - ${latency} ${method} ${path}\n",
}))
if viper.GetBool("performance.request_logging") {
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Administration] [${time}] ${status} - ${latency} ${method} ${path}\n",
}))
}
app.Use(basicauth.New(basicauth.Config{
Realm: fmt.Sprintf("RoadSign v%s", roadsign.AppVersion),

View File

@ -22,10 +22,12 @@ func InitServer() *fiber.App {
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
})
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Proxies] [${time}] ${status} - ${latency} ${method} ${path}\n",
}))
if viper.GetBool("performance.request_logging") {
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Proxies] [${time}] ${status} - ${latency} ${method} ${path}\n",
}))
}
if viper.GetInt("hypertext.limitation.max_qps") > 0 {
app.Use(limiter.New(limiter.Config{

View File

@ -13,11 +13,12 @@ hypertext:
max_body_size: -1
max_qps: -1
ports:
- :80
- :8000
secured_ports: []
paths:
configs: ./config
performance:
request_logging: true
network_timeout: 3000
prefork: false
security:

View File

@ -8,25 +8,31 @@ Welcome to contribute more tests of others reverse proxy software!
All tests are running on my workstation:
```text
.., LittleSheep@PEROPERO-WORKSTATION
....,,:;+ccllll --------------------------------
...,,+:; cllllllllllllllllll OS: Windows 10 Pro x86_64
,cclllllllllll lllllllllllllllllll Host: LENOVO 82TF
llllllllllllll lllllllllllllllllll Kernel: 10.0.19045
llllllllllllll lllllllllllllllllll Uptime: 1 hour, 22 mins
llllllllllllll lllllllllllllllllll Shell: pwsh 7.4.0
llllllllllllll lllllllllllllllllll Resolution: 2560x1600
llllllllllllll lllllllllllllllllll DE: Aero
WM: Explorer
llllllllllllll lllllllllllllllllll WM Theme: Custom
llllllllllllll lllllllllllllllllll Terminal: Windows Terminal
llllllllllllll lllllllllllllllllll CPU: 12th Gen Intel i7-12700H (20) @ 2.690GHz
llllllllllllll lllllllllllllllllll GPU: Caption
llllllllllllll lllllllllllllllllll GPU: NVIDIA GeForce RTX 3070 Laptop GPU
`'ccllllllllll lllllllllllllllllll GPU
`' \*:: :ccllllllllllllllll Memory: 7318MiB / 16192MiB
````''*::cll
``
..' littlesheep@LittleSheepdeMacBook-Pro
,xNMM. ------------------------------------
.OMMMMo OS: macOS Sonoma 14.1 23B2073 arm64
lMM" Host: MacBook Pro (14-inch, Nov 2023, Three Thunderbolt 4 ports)
.;loddo:. .olloddol;. Kernel: 23.1.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 2 days, 1 hour, 16 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 63 (brew), 4 (brew-cask)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM: Display (Color LCD): 3024x1964 @ 120Hz (as 1512x982) [Built-in]
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Multicolor (Dark)
'XMMMMMMMMMMMMMMMMMMMMMMMMMMk Font: .AppleSystemUIFont [System], Helvetica [User]
'XMMMMMMMMMMMMMMMMMMMMMMMMK. Cursor: Fill - Black, Outline - White (32px)
kMMMMMMMMMMMMMMMMMMMMMMd Terminal: iTerm 3.4.22
;KMMMMMMMWXXWMMMMMMMk. Terminal Font: MesloLGMNFM-Regular (12pt)
"cooc*" "*coo'" CPU: Apple M3 Max (14) @ 4.06 GHz
GPU: Apple M3 Max (30) [Integrated]
Memory: 18.45 GiB / 36.00 GiB (51%)
Swap: Disabled
Disk (/): 72.52 GiB / 926.35 GiB (8%) - apfs [Read-only]
Local IP (en0): 192.168.50.0/24 *
Battery: 100% [AC connected]
Power Adapter: 96W USB-C Power Adapter
Locale: zh_CN.UTF-8
```
## Results
@ -54,13 +60,13 @@ go-wrk -c 60 -d 120 http://localhost:8001
go-wrk -c 60 -d 120 http://localhost:8000
# => Running 120s test @ http://localhost:8000
# => 60 goroutine(s) running concurrently
# => 3256820 requests in 1m59.446620043s, 1.43GB read
# => Requests/sec: 27265.90
# => Transfer/sec: 12.27MB
# => Avg Req Time: 2.20055ms
# => Fastest Request: 0s
# => Slowest Request: 56.8726ms
# => Number of Errors: 0
# => 8905230 requests in 1m56.215762709s, 3.52GB read
# => Requests/sec: 76626.70
# => Transfer/sec: 30.98MB
# => Avg Req Time: 783.016µs
# => Fastest Request: 28.542µs
# => Slowest Request: 46.773083ms
# => Number of Errors: 0
```
### RoadSign w/ Prefork
@ -68,12 +74,12 @@ go-wrk -c 60 -d 120 http://localhost:8000
```shell
go-wrk -c 60 -d 120 http://localhost:8000
# => Running 120s test @ http://localhost:8000
# => 60 goroutine(s) running concurrently
# => 2188594 requests in 1m59.933175915s, 985.16MB read
# => Requests/sec: 18248.45
# => Transfer/sec: 8.21MB
# => Avg Req Time: 3.287951ms
# => Fastest Request: 0s
# => Slowest Request: 121.5189ms
# => Number of Errors: 0
```
# => 60 goroutine(s) running concurrently
# => 4784308 requests in 1m59.100307178s, 1.89GB read
# => Requests/sec: 40170.41
# => Transfer/sec: 16.24MB
# => Avg Req Time: 1.493636ms
# => Fastest Request: 34.291µs
# => Slowest Request: 8.727666ms
# => Number of Errors: 0
```

View File

@ -17,6 +17,7 @@ hypertext:
paths:
configs: ./config
performance:
request_logging: false
network_timeout: 3000
prefork: true
security:

View File

@ -17,6 +17,7 @@ hypertext:
paths:
configs: ./config
performance:
request_logging: false
network_timeout: 3000
prefork: false
security: