测压工具的名称:httpd-tools
这工具是测试网站的并发访问量使用的工具,apache-httpd 会自带,nginx等其他web,需要下载。
使用方法:ab
常用参数为-n、-c
参数 | 解析 |
---|---|
-n | 要执行的请求数 |
-c | concurrency 一次发出的多个请求的数量 |
-t | timelimit 秒到最大值。花在基准测试上这意味着 -n 50000 |
-s | timeout 秒到最大值。等待每个响应默认为 30 秒 |
-b | windowsize TCP 发送/接收缓冲区的大小,以字节为单位 |
-B | address 进行传出连接时绑定的地址 |
-p | ostfile 包含要 POST 的数据的文件。还记得设置 -T |
-u | putfile 包含要 PUT 的数据的文件。还记得设置 -T |
-T | content-type 用于 POST/PUT 数据的内容类型标头,例如。'应用程序/xwww-form-urlencoded’默认为“文本/纯文本” |
-v | verbosity 要打印多少故障排除信息 |
-w | 在 HTML 表格中打印结果 |
-i | 使用 HEAD 而不是 GET |
-x | 属性 要作为表属性插入的字符串 |
-y | 属性字符串作为 tr 属性插入 |
-z | 属性字符串作为 td 或 th 属性插入 |
-C | 属性 添加 cookie,例如。 ‘阿帕奇= 1234’。 (可重复) |
-H | 属性添加任意标题行,例如。 '接受编码:gzip’在所有正常标题行之后插入。 (可重复) |
-A | 属性 添加 Basic WWW Authentication,属性是冒号分隔的用户名和密码。 |
-P | 属性 添加Basic Proxy Authentication,属性是冒号分隔的用户名和密码。 |
-X | proxy:port 代理服务器和使用的端口号 |
-V | 打印版本号并退出 |
-k | 使用 HTTP KeepAlive 功能 |
-d | 不显示百分位数服务表 |
-S | 不显示置信度估计值和警告。 |
-q | 执行超过 150 个请求时不显示进度 |
-g | filename 将收集到的数据输出到 gnuplot 格式文件。 |
-e | filename 输出带有百分比的 CSV 文件 |
-r | 不要在套接字接收错误时退出 |
-h | 显示使用信息(此消息) |
-Z | ciphersuite 指定 SSL/TLS 密码套件(参见 openssl 密码) |
-f | protocol 指定 SSL/TLS 协议 |
[root@localhost ~]# ab -n 1000 -c 5 http://www.1.html.com/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.1.html.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx/1.20.1 ##探测的版本号
Server Hostname: www.1.html.com ##主机名字
Server Port: 80 ##端口
Document Path: / ##探测位置
Document Length: 52 bytes ##多少字节
Concurrency Level: 5 ##探测次数
Time taken for tests: 0.188 seconds ##测试时间
Complete requests: 1000 ##测试次数
Failed requests: 0 ##失败次数
Write errors: 0 ##
Total transferred: 283000 bytes ##传输字节
HTML transferred: 52000 bytes ##包字节
Requests per second: 5330.95 [#/sec] (mean)
Time per request: 0.938 [ms] (mean)
Time per request: 0.188 [ms] (mean, across all concurrent requests)
Transfer rate: 1473.30 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 3
Processing: 0 1 0.4 0 5
Waiting: 0 0 0.4 0 5
Total: 0 1 0.6 1 6
ERROR: The median and mean for the processing time are more than twice the standard
deviation apart. These results are NOT reliable.
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 3
99% 4
100% 6 (longest request)