Um utilitário de referência da estrutura HTTP mais moderna.
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
Com sinalizador opcional -PCT
+ --------------- + --------------- +
| Percentile | Avg Latency |
+ --------------- + --------------- +
| 99.9% | 6.88ms |
| 99% | 5.62ms |
| 95% | 4.62ms |
| 90% | 4.24ms |
| 75% | 3.78ms |
| 50% | 3.49ms |
+ --------------- + --------------- +
A motivação por trás deste projeto se estende da visão de túnel de desenvolvedores em benchmarks como o TechemPower que usa a ferramenta de benchmarking chamada WRK.
A questão é que o WRK lida apenas com algumas das especificações HTTP e é totalmente tendencioso em relação a estruturas e servidores que podem fazer uso pesado de http/1 pipelining, que não é mais ativado na maioria dos navegadores ou clientes modernos, isso pode dar um conjunto muito injusto e irracional de estatísticas quando as ótimas estruturas são usadas.
É aqui que entra o Rewrk, este benchmarker é construído no topo da API do cliente da Hyper e traz muitas vantagens e métodos mais realistas de benchmarking.
O uso é relativamente simples, se você tiver um binário compilado, basta executar usando a CLI.
Aqui está um exemplo para produzir o seguinte benchmark:
-c 256 )--http2 )-t 12 )-d 15s )--pct )http://127.0.0.1:5000 ( -h http://127.0.0.1:5000 ) Comando da CLI:
rewrk -c 256 -t 12 -d 15s -h http://127.0.0.1:5000 --http2 --pct
Para trazer à tona o menu de ajuda, basta executar rewrk --help para produzir isso:
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]
A construção da fonte é incrivelmente simples, apenas certifique -se de ter uma versão estável da Rust instalada antes de começar.
Com instalação de carga
cargo install rewrk --git https://github.com/ChillFish8/rewrk.gitCom carga de carga
cargo run --release -- <enter flags here>Com construção de carga
cargo build --release