hey压测

安装

brew install hey

使用

Usage: hey [options...] <url>

Options:
  -n  Number of requests to run. Default is 200.
  -c  Number of workers to run concurrently. Total number of requests cannot
      be smaller than the concurrency level. Default is 50.
  -q  Rate limit, in queries per second (QPS) per worker. Default is no rate limit.
  -z  Duration of application to send requests. When duration is reached,
      application stops and exits. If duration is specified, n is ignored.
      Examples: -z 10s -z 3m.
  -o  Output type. If none provided, a summary is printed.
      "csv" is the only supported alternative. Dumps the response
      metrics in comma-separated values format.

  -m  HTTP method, one of GET, POST, PUT, DELETE, HEAD, OPTIONS.
  -H  Custom HTTP header. You can specify as many as needed by repeating the flag.
      For example, -H "Accept: text/html" -H "Content-Type: application/xml" .
  -t  Timeout for each request in seconds. Default is 20, use 0 for infinite.
  -A  HTTP Accept header.
  -d  HTTP request body.
  -D  HTTP request body from file. For example, /home/user/file.txt or ./file.txt.
  -T  Content-type, defaults to "text/html".
  -a  Basic authentication, username:password.
  -x  HTTP Proxy address as host:port.
  -h2 Enable HTTP/2.

  -host	HTTP Host header.

  -disable-compression  Disable compression.
  -disable-keepalive    Disable keep-alive, prevents re-use of TCP
                        connections between different HTTP requests.
  -disable-redirects    Disable following of HTTP redirects
  -cpus                 Number of used cpu cores.
                        (default for current machine is 8 cores)
-n要运行的请求数,默认是200
-c并发运行的请求数,默认是50
-q速率限制,QPS
-z持续时间
-o输出类型
-mHTTP METHOD
-H自定义头部
-t超时时间
-A接收的Header
-d请求的Body
-D自定义Body
-TCONTENT-TYPE
-a身份验证
-x代理
-h2开启HTTP2
-hostHTTP Host header.
-disable-compression禁用压缩
-disable-keepalive禁用keep-alive
-disable-redirects禁用HTTP重定向的后续操作
-cpus使用的CPU核数=

示例

➜  ~ hey -t 5 -c 50 -m GET https://www.baidu.com/ -q 20

Summary:
  Total:	0.5663 secs
  Slowest:	0.4331 secs
  Fastest:	0.0406 secs
  Average:	0.0991 secs
  Requests/sec:	353.1415

  Total data:	45400 bytes
  Size/request:	227 bytes

Response time histogram:
  0.041 [1]	|
  0.080 [149]	|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.119 [0]	|
  0.158 [0]	|
  0.198 [0]	|
  0.237 [0]	|
  0.276 [48]	|■■■■■■■■■■■■■
  0.315 [1]	|
  0.355 [0]	|
  0.394 [0]	|
  0.433 [1]	|


Latency distribution:
  10% in 0.0437 secs
  25% in 0.0449 secs
  50% in 0.0459 secs
  75% in 0.2466 secs
  90% in 0.2577 secs
  95% in 0.2630 secs
  99% in 0.2877 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0523 secs, 0.0406 secs, 0.4331 secs
  DNS-lookup:	0.0114 secs, 0.0000 secs, 0.0460 secs
  req write:	0.0001 secs, 0.0000 secs, 0.0012 secs
  resp wait:	0.0467 secs, 0.0405 secs, 0.2108 secs
  resp read:	0.0001 secs, 0.0000 secs, 0.0004 secs

Status code distribution:
  [200]	200 responses

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值