This commit is contained in:
parent
b1a6364618
commit
78c51bb432
39
README.md
39
README.md
@ -16,36 +16,15 @@ A blazing fast reverse proxy with a lot of shining features.
|
||||
|
||||
### How fast is it?
|
||||
|
||||
Static Files Hosting
|
||||
We use roadsign and nginx to host a same static file, and test them with [go-wrk](https://github.com/tsliwowicz/go-wrk).
|
||||
Here's the result:
|
||||
|
||||
```shell
|
||||
go-wrk -t=8 -c=100 -n=10000 "http://localhost"
|
||||
```
|
||||
| **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 |
|
||||
|
||||
```text
|
||||
==========================BENCHMARK==========================
|
||||
URL: http://localhost
|
||||
As result, roadsign undoubtedly is the fastest one.
|
||||
|
||||
Used Connections: 100
|
||||
Used Threads: 8
|
||||
Total number of calls: 10000
|
||||
|
||||
===========================TIMINGS===========================
|
||||
Total time passed: 11.36s
|
||||
Avg time per request: 112.69ms
|
||||
Requests per second: 880.32
|
||||
Median time per request: 111.14ms
|
||||
99th percentile time: 160.88ms
|
||||
Slowest time for request: 217.00ms
|
||||
|
||||
=============================DATA=============================
|
||||
Total response body sizes: 190130000
|
||||
Avg response body per request: 19013.00 Byte
|
||||
Transfer rate per second: 16737517.73 Byte/s (16.74 MByte/s)
|
||||
==========================RESPONSES==========================
|
||||
20X Responses: 10000 (100.00%)
|
||||
30X Responses: 0 (0.00%)
|
||||
40X Responses: 0 (0.00%)
|
||||
50X Responses: 0 (0.00%)
|
||||
Errors: 0 (0.00%)
|
||||
```
|
||||
More details can be found at benchmark's [README.md](./test/benchmark/README.md)
|
6
go.mod
6
go.mod
@ -4,14 +4,16 @@ go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/gofiber/fiber/v2 v2.51.0
|
||||
github.com/google/uuid v1.4.0
|
||||
github.com/rs/zerolog v1.31.0
|
||||
github.com/samber/lo v1.38.1
|
||||
github.com/spf13/viper v1.17.0
|
||||
github.com/valyala/fasthttp v1.50.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/google/uuid v1.4.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/klauspost/compress v1.17.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
@ -24,7 +26,6 @@ require (
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
@ -32,7 +33,6 @@ require (
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.50.0 // indirect
|
||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.9.0 // indirect
|
||||
|
79
test/benchmark/README.md
Normal file
79
test/benchmark/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
# Benchmark
|
||||
|
||||
This result is design for test the performance of the roadsign.
|
||||
Welcome to contribute more tests of others reverse proxy software!
|
||||
|
||||
## Platform
|
||||
|
||||
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
|
||||
``
|
||||
```
|
||||
|
||||
## Results
|
||||
|
||||
The tests are run in the order `nginx -> roadsign without prefork -> roadsign with prefork`. There is no reason why nginx performance should be affected by hardware temperature.
|
||||
|
||||
### Nginx
|
||||
|
||||
```shell
|
||||
go-wrk -c 60 -d 120 http://localhost:8001
|
||||
# => Running 120s test @ http://localhost:8001
|
||||
# => 60 goroutine(s) running concurrently
|
||||
# => 515749 requests in 1m59.953302003s, 245.92MB read
|
||||
# => Requests/sec: 4299.58
|
||||
# => Transfer/sec: 2.05MB
|
||||
# => Avg Req Time: 13.954846ms
|
||||
# => Fastest Request: 0s
|
||||
# => Slowest Request: 410.6972ms
|
||||
# => Number of Errors: 0
|
||||
```
|
||||
|
||||
### RoadSign
|
||||
|
||||
```shell
|
||||
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
|
||||
```
|
||||
|
||||
### RoadSign w/ Prefork
|
||||
|
||||
```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
|
||||
```
|
12
test/benchmark/data/index.html
Normal file
12
test/benchmark/data/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Hello, World!</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Hello, there!</p>
|
||||
<p>Here's the roadsign vs. nginx benchmarking test data!</p>
|
||||
</body>
|
||||
</html>
|
117
test/benchmark/nginx/nginx.conf
Normal file
117
test/benchmark/nginx/nginx.conf
Normal file
@ -0,0 +1,117 @@
|
||||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
# '$status $body_bytes_sent "$http_referer" '
|
||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
#access_log logs/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 8001;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
|
||||
#access_log logs/host.access.log main;
|
||||
|
||||
location / {
|
||||
root ../data;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# another virtual host using mix of IP-, name-, and port-based configuration
|
||||
#
|
||||
#server {
|
||||
# listen 8000;
|
||||
# listen somename:8080;
|
||||
# server_name somename alias another.alias;
|
||||
|
||||
# location / {
|
||||
# root html;
|
||||
# index index.html index.htm;
|
||||
# }
|
||||
#}
|
||||
|
||||
|
||||
# HTTPS server
|
||||
#
|
||||
#server {
|
||||
# listen 443 ssl;
|
||||
# server_name localhost;
|
||||
|
||||
# ssl_certificate cert.pem;
|
||||
# ssl_certificate_key cert.key;
|
||||
|
||||
# ssl_session_cache shared:SSL:1m;
|
||||
# ssl_session_timeout 5m;
|
||||
|
||||
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
|
||||
# location / {
|
||||
# root html;
|
||||
# index index.html index.htm;
|
||||
# }
|
||||
#}
|
||||
|
||||
}
|
20
test/benchmark/roadsign-with-prefork/config/example.json
Normal file
20
test/benchmark/roadsign-with-prefork/config/example.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Example Site",
|
||||
"rules": [
|
||||
{
|
||||
"host": [
|
||||
"localhost:8000"
|
||||
],
|
||||
"path": [
|
||||
"/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"upstreams": [
|
||||
{
|
||||
"id": "example",
|
||||
"name": "Benchmarking Data",
|
||||
"uri": "files://../data"
|
||||
}
|
||||
]
|
||||
}
|
25
test/benchmark/roadsign-with-prefork/settings.yml
Normal file
25
test/benchmark/roadsign-with-prefork/settings.yml
Normal file
@ -0,0 +1,25 @@
|
||||
debug:
|
||||
print_routes: false
|
||||
hypertext:
|
||||
administration_ports: []
|
||||
administration_secured_ports: []
|
||||
certificate:
|
||||
administration_key: ./cert.key
|
||||
administration_pem: ./cert.pem
|
||||
key: ./cert.key
|
||||
pem: ./cert.pem
|
||||
limitation:
|
||||
max_body_size: -1
|
||||
max_qps: -1
|
||||
ports:
|
||||
- :8000
|
||||
secured_ports: []
|
||||
paths:
|
||||
configs: ./config
|
||||
performance:
|
||||
network_timeout: 3000
|
||||
prefork: true
|
||||
security:
|
||||
administration_trusted_proxies:
|
||||
- localhost
|
||||
credential: e81f43f32d934271af6322e5376f5f59
|
20
test/benchmark/roadsign/config/example.json
Normal file
20
test/benchmark/roadsign/config/example.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Example Site",
|
||||
"rules": [
|
||||
{
|
||||
"host": [
|
||||
"localhost:8000"
|
||||
],
|
||||
"path": [
|
||||
"/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"upstreams": [
|
||||
{
|
||||
"id": "example",
|
||||
"name": "Benchmarking Data",
|
||||
"uri": "files://../data"
|
||||
}
|
||||
]
|
||||
}
|
25
test/benchmark/roadsign/settings.yml
Normal file
25
test/benchmark/roadsign/settings.yml
Normal file
@ -0,0 +1,25 @@
|
||||
debug:
|
||||
print_routes: false
|
||||
hypertext:
|
||||
administration_ports: []
|
||||
administration_secured_ports: []
|
||||
certificate:
|
||||
administration_key: ./cert.key
|
||||
administration_pem: ./cert.pem
|
||||
key: ./cert.key
|
||||
pem: ./cert.pem
|
||||
limitation:
|
||||
max_body_size: -1
|
||||
max_qps: -1
|
||||
ports:
|
||||
- :8000
|
||||
secured_ports: []
|
||||
paths:
|
||||
configs: ./config
|
||||
performance:
|
||||
network_timeout: 3000
|
||||
prefork: false
|
||||
security:
|
||||
administration_trusted_proxies:
|
||||
- localhost
|
||||
credential: e81f43f32d934271af6322e5376f5f59
|
Loading…
Reference in New Issue
Block a user