Bombardier
Bombardier
gihub地址:https://github.com/codesenberg/bombardier/releases
bombardier is a HTTP(S) benchmarking tool. It is written in Go programming language and uses excellent fasthttp instead of Go's default http library, because of its lightning fast performance.
With bombardier v1.1
and higher you can now use net/http
client if you need to test HTTP/2.x services or want to use a more RFC-compliant HTTP client.
- 帮助
PS C:\Windows\system32> bombardier --help
usage: D:\soft\bombardier\bombardier.exe []
Fast cross-platform HTTP benchmarking tool
Flags:
--help Show context-sensitive help (also try --help-long
and --help-man).
--version Show application version.
-c, --connections=125 Maximum number of concurrent connections
-t, --timeout=2s Socket/request timeout
-l, --latencies Print latency statistics
-m, --method=GET Request method
-b, --body="" Request body
-f, --body-file="" File to use as request body
-s, --stream Specify whether to stream body using chunked
transfer encoding or to serve it from memory
--cert="" Path to the client's TLS Certificate
--key="" Path to the client's TLS Certificate Private Key
-k, --insecure Controls whether a client verifies the server's
certificate chain and host name
-a, --disableKeepAlives Disable HTTP keep-alive. For fasthttp use -H
'Connection: close'
-H, --header="K: V" ... HTTP headers to use(can be repeated)
-n, --requests=[pos. int.] Number of requests
-d, --duration=10s Duration of test
-r, --rate=[pos. int.] Rate limit in requests per second
--fasthttp Use fasthttp client
--http1 Use net/http client with forced HTTP/1.x
--http2 Use net/http client with enabled HTTP/2.0
values 'intro' (short: 'i'), 'progress' (short:
'p'), 'result' (short: 'r'). Examples:
* i,p,r (prints everything)
* intro,result (intro & result)
* r (result only)
* result (same as above)
-q, --no-print Don't output anything
-o, --format= Which format to use to output the result.
is either a name (or its shorthand) of some format
user-defined template, which uses Go's
text/template syntax, prefixed with 'path:' string
(without single quotes), i.e.
"path:/some/path/to/your.template" or
"path:C:\some\path\to\your.template" in case of
Windows. Formats understood by bombardier are:
* plain-text (short: pt)
* json (short: j)
Target's URL
- 示例1:使用发送时间压测
PS C:\Windows\system32> bombardier -c 10 -t 2s -d 10s -l --method=GET http://localhost:8000/books/1
Bombarding http://localhost:8000/books/1 for 10s using 10 connection(s)
[=================================================================================================================] 10s
Done!
Statistics Avg Stdev Max
Reqs/sec 15321.33 3915.71 25299.62
Latency 651.05us 260.29us 43.91ms
Latency Distribution
50% 1.00ms
75% 1.00ms
90% 1.00ms
95% 1.00ms
99% 2.00ms
HTTP codes:
1xx - 0, 2xx - 153222, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 3.87MB/s
- 示例2:使用发送个数压测
PS C:\Windows\system32> bombardier -c 10 -t 2s -n 10000 -l --method=GET http://localhost:8000/books/1
Bombarding http://localhost:8000/books/1 with 10000 request(s) using 10 connection(s)
10000 / 10000 [===================================================================================] 100.00% 16294/s 0s
Done!
Statistics Avg Stdev Max
Reqs/sec 18821.40 5235.70 24562.63
Latency 529.00us 465.62us 32.11ms
Latency Distribution
50% 0.00us
75% 1.00ms
90% 1.00ms
95% 1.00ms
99% 1.00ms
HTTP codes:
1xx - 0, 2xx - 10000, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 4.76MB/s