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