From ef0464234a5841f711bf3ac841f4f990aadfd730 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 30 Nov 2023 22:35:46 +0800 Subject: [PATCH] :memo: Update benchmark --- README.md | 10 ++- settings.yml | 3 +- test/benchmark/README.md | 76 ++++++++++--------- .../roadsign-with-prefork/settings.yml | 1 + test/benchmark/roadsign/settings.yml | 1 + 5 files changed, 51 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 04c3375..c92bcd1 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file diff --git a/settings.yml b/settings.yml index cdea58d..76f6d92 100644 --- a/settings.yml +++ b/settings.yml @@ -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: diff --git a/test/benchmark/README.md b/test/benchmark/README.md index cc72572..ba76b2c 100644 --- a/test/benchmark/README.md +++ b/test/benchmark/README.md @@ -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 -``` \ No newline at end of file +# => 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 +``` diff --git a/test/benchmark/roadsign-with-prefork/settings.yml b/test/benchmark/roadsign-with-prefork/settings.yml index 5b85f82..a36620d 100644 --- a/test/benchmark/roadsign-with-prefork/settings.yml +++ b/test/benchmark/roadsign-with-prefork/settings.yml @@ -17,6 +17,7 @@ hypertext: paths: configs: ./config performance: + request_logging: false network_timeout: 3000 prefork: true security: diff --git a/test/benchmark/roadsign/settings.yml b/test/benchmark/roadsign/settings.yml index 28c0507..8e5bdd2 100644 --- a/test/benchmark/roadsign/settings.yml +++ b/test/benchmark/roadsign/settings.yml @@ -17,6 +17,7 @@ hypertext: paths: configs: ./config performance: + request_logging: false network_timeout: 3000 prefork: false security: