rewrk
? Version 0.3.2
更現代的HTTP框架基準實用程序。
F:rewrk> rewrk -h http://127.0.0.1:5000 -t 12 -c 60 -d 5s
Benchmarking 60 connections @ http://127.0.0.1:5000 for 5 seconds
Latencies:
Avg Stdev Min Max
3.27ms 0.40ms 1.95ms 9.39ms
Requests:
Total: 91281 Req/Sec: 18227.81
Transfer:
Total: 1.13 MB Transfer Rate: 231.41 KB/Sec
帶有可選的-PCT標誌
+ --------------- + --------------- +
| Percentile | Avg Latency |
+ --------------- + --------------- +
| 99.9% | 6.88ms |
| 99% | 5.62ms |
| 95% | 4.62ms |
| 90% | 4.24ms |
| 75% | 3.78ms |
| 50% | 3.49ms |
+ --------------- + --------------- +
該項目背後的動機從開發人員隧道的願景上延伸到基准上的Techempower等基準,這些基準功率使用了稱為WRK的基準測試工具。
問題在於WRK僅處理一些HTTP規格,並且完全偏向框架和服務器,這些框架和服務器可以大量使用http/1管道式的管道,而在大多數現代瀏覽器或客戶中不再啟用,這可以在比較框架時可以使框架非常不合理,因為在最高的框架中可以更好地使用框架,而這些統計數據是更好地使用的過程。
這是Rewrk進入的地方,該基準測試器建立在Hyper的客戶端API之上,並帶來了許多優勢和更現實的基準測試方法。
使用情況相對簡單,如果您有彙編的二進製文件,則簡單地使用CLI運行。
這是產生以下基準的一個示例:
-c 256 )--http2 )-t 12 )-d 15s )--pct )http://127.0.0.1:5000 -h http://127.0.0.1:5000 ) CLI命令:
rewrk -c 256 -t 12 -d 15s -h http://127.0.0.1:5000 --http2 --pct
為了提出幫助菜單,只需運行rewrk --help即可產生以下方式:
USAGE:
rewrk.exe [FLAGS] [OPTIONS] --duration <duration> --host <host>
FLAGS:
--help Prints help information
--http2 Set the client to use http2 only. (default is http/1) e.g. '--http2'
--pct Displays the percentile table after benchmarking.
-V, --version Prints version information
OPTIONS:
-c, --connections <connections> Set the amount of concurrent e.g. '-c 512' [default: 1]
-d, --duration <duration> Set the duration of the benchmark.
-h, --host <host> Set the host to bench e.g. '-h http://127.0.0.1:5050'
-t, --threads <threads> Set the amount of threads to use e.g. '-t 12' [default: 1]
從源構建非常簡單,只需確保在開始之前安裝了穩定的Rust版本即可。
使用貨物安裝
cargo install rewrk --git https://github.com/ChillFish8/rewrk.git貨物運行
cargo run --release -- <enter flags here>與貨物建造
cargo build --release